[#61424] [REJECT?] xmalloc/xfree: reduce atomic ops w/ thread-locals — Eric Wong <normalperson@...>

I'm unsure about this. I _hate_ the extra branches this adds;

13 messages 2014/03/12

[ruby-core:61242] Re: [ruby-trunk - Feature #9425] [PATCH] st: use power-of-two sizes to avoid slow modulo ops

From: Eric Wong <normalperson@...>
Date: 2014-03-03 06:29:50 UTC
List: ruby-core #61242
normalperson@yhbt.net wrote:
>    test and verify compare_by_identity performance
>  
>  I'm comfortable that ID, string and most objects will hash well with
>  power-of-two; but compare_by_identity, weakmap, vm->living_threads may
>  hash less well without a prime modulo (or maybe they hash badly
>  regardless of modulo!)

OK, I was right about compare_by_identity being worse with power-of-two,
but I fixed it by tweaking numhash:

http://bogomips.org/ruby.git/patch?id=1579e9d0d82789

I was wrong about IDs hashing well before, they hash OK now :)

results: http://80x24.org/bmlog-20140303-034047.26775.txt
the hash parts:
	hash_aref_miss	1.048
	hash_aref_str	1.162
	hash_aref_sym	1.000
	hash_flatten	1.092
	hash_ident_num	1.007
	hash_ident_obj	1.098
	hash_ident_str	1.106
	hash_ident_sym	1.018
	hash_keys	1.000
	hash_shift	1.011
	hash_values	1.011
	vm2_bighash*	1.183

These numbers are from my weaker AMD FX-8320 which gave me worse numbers
than my Haswell machine in my original test.  I'll try to test on my
Haswell machine soon (network outage there :<).

I'd like to commit the following three patches soon:
http://bogomips.org/ruby.git/patch?id=a3fde671ffeec8 new hash benchmarks
http://bogomips.org/ruby.git/patch?id=8f155afef61342 original patch
http://bogomips.org/ruby.git/patch?id=1579e9d0d82789 numhash tweak

In This Thread

Prev Next