Re: Tiny, tiny speedup for g_hash_table



Michael Slade wrote:
> 
> The patch attached effectively eliminates the need for g_hash_freeze().
> Each table update requires two compares, instead of the one check for
> table->frozen. :)
> 
> cons:
> -       One extra int in the GHashTable structure
> -       g_hash_freeze() gets terminated with extreme prejudice :)
> 
> I did a quick profile with "time" - I increased the hash table size to
> 1000000 in tests/hash-test.c, ran it 20 times and summed up the
> results.  According to the numbers there was a 1% speed improvement.
> Maybe I should use a better profiling method...
> 
> Yes, this is pretty trivial, but I'm obsessed with speed. :)

It's good to know there's someone else that thinks like
I do. It seems to me that speed is almost always a
worthwhile goal, provided it doesn't prevent (or excessively
hamper) future development.

> 
> The patch also tweaks tests/hash-test.c to add an ARRAYSIZE define.
> 
> Mick.

-Jeff
-- 
-Jeff Evarts
--jdeassoc@earthlink.net
---http://www.ecst.csuchico.edu/~amarth/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]