This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Speedup aliasing (on tramp3d -O1)

Jan Hubicka wrote:
> Hi,
> on tramp3d (and my favorite testcase too), aliasing spends about 6-10%
> of -O1 compilation time by checking bitmaps for equivalency.

How much faster does this change make the compiler?

As a general rule, if you're providing a patch to speed up either the
compiler or the generated code on a particular benchmark, you should say
what you measured and what improvement your patch provides.

> +/* Compute checksum of bitmap (for purposes of hashing).  */
> +unsigned long
> +bitmap_checksum (bitmap head)

As Dan Berlin said, this should be bitmap_hash.  (Checksums are used to
check that something (often a stream of data) is likely to be the thing
you expected.  Hashes are used to store things in hash tables, and
should ideally be randomly distributed over the key space.)

This function should be declared to return a hashval_t since that's how
you're using it.  Besides being confusing, this is potentially
suboptimal: you're truncating from unsigned long to hashval_t (which is
actually an unsigned int) which does not in general preserve the
desirable properties of a hash function.  Finally, since you're
returning a hashval_t, you should insert a cast somewhere in the
function -- either at the point of return, or as you read the various
chunks out of the bitmap, so that it is clear that you understand that
the conversion is taking place.

OK with those changes.

Mark Mitchell
(650) 331-3385 x713

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]