dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH] fix flonum hashing regression from r45384
@ 2015-01-21 22:03 Eric Wong
  2015-01-21 22:15 ` flonum hash fix regression benchmark results Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2015-01-21 22:03 UTC (permalink / raw)
  To: spew

* st.c (st_numhash): use float value for flonum
* hash.c (rb_any_hash): ditto
* benchmark/bm_hash_aref_flo.rb: new benchmark
* benchmark/bm_hash_aref_flo_ident.rb: ditto
  [Bug #10761]
---
 benchmark/bm_hash_aref_flo.rb       | 4 ++++
 benchmark/bm_hash_aref_flo_ident.rb | 4 ++++
 hash.c                              | 7 ++++++-
 st.c                                | 5 +++++
 4 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 benchmark/bm_hash_aref_flo.rb
 create mode 100644 benchmark/bm_hash_aref_flo_ident.rb

diff --git a/benchmark/bm_hash_aref_flo.rb b/benchmark/bm_hash_aref_flo.rb
new file mode 100644
index 0000000..a097bb5
--- /dev/null
+++ b/benchmark/bm_hash_aref_flo.rb
@@ -0,0 +1,4 @@
+h = {}
+strs = (1..10000).to_a.map!(&:to_f)
+strs.each { |s| h[s] = s }
+50.times { strs.each { |s| h[s] } }
diff --git a/benchmark/bm_hash_aref_flo_ident.rb b/benchmark/bm_hash_aref_flo_ident.rb
new file mode 100644
index 0000000..0c7edfe
--- /dev/null
+++ b/benchmark/bm_hash_aref_flo_ident.rb
@@ -0,0 +1,4 @@
+h = {}.compare_by_identity
+strs = (1..10000).to_a.map!(&:to_f)
+strs.each { |s| h[s] = s }
+50.times { strs.each { |s| h[s] } }
diff --git a/hash.c b/hash.c
index d54ab8a..3a90fdb 100644
--- a/hash.c
+++ b/hash.c
@@ -137,7 +137,12 @@ rb_any_hash(VALUE a)
 
     if (SPECIAL_CONST_P(a)) {
 	if (a == Qundef) return 0;
-	if (STATIC_SYM_P(a)) a >>= (RUBY_SPECIAL_SHIFT + ID_SCOPE_SHIFT);
+	if (STATIC_SYM_P(a)) {
+	    a >>= (RUBY_SPECIAL_SHIFT + ID_SCOPE_SHIFT);
+	}
+	else if (FLONUM_P(a)) {
+	    a = (st_index_t)rb_float_value(a);
+	}
 	hnum = rb_objid_hash((st_index_t)a);
     }
     else if (BUILTIN_TYPE(a) == T_STRING) {
diff --git a/st.c b/st.c
index b7f66d0..2ffa986 100644
--- a/st.c
+++ b/st.c
@@ -1762,5 +1762,10 @@ st_numhash(st_data_t n)
      * - avoid expensive modulo instructions, it is currently only
      *   shifts and bitmask operations.
      */
+#ifdef USE_FLONUM /* RUBY */
+    if (FLONUM_P(n))
+	return (st_index_t)rb_float_value(n);
+#endif
+
     return (st_index_t)((n>>(RUBY_SPECIAL_SHIFT+3)|(n<<3)) ^ (n>>3));
 }
-- 
EW


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* flonum hash fix regression benchmark results
  2015-01-21 22:03 [PATCH] fix flonum hashing regression from r45384 Eric Wong
@ 2015-01-21 22:15 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2015-01-21 22:15 UTC (permalink / raw)
  To: spew

Speedup ratio: compare with the result of `2.1.5' (greater is better)
name	trunk	built
hash_aref_flo	0.008	1.570
hash_aref_flo_ident	0.005	1.288
hash_aref_miss	1.198	1.176
hash_aref_str	1.195	1.193
hash_aref_sym	1.312	1.296
hash_aref_sym_long	1.355	1.330
hash_flatten	1.355	1.373
hash_ident_num	1.189	1.180
hash_ident_obj	1.206	1.214
hash_ident_str	1.233	1.228
hash_ident_sym	1.247	1.205
hash_keys	0.949	0.949
hash_shift	1.045	1.049
hash_values	0.960	0.962
loop_whileloop2	0.992	0.991
vm2_bighash*	1.340	1.342

2015-01-21 22:06:16 +0000
target 0: 2.1.5 (ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]) at "/home/ew/ruby-2.1/bin/ruby"
target 1: trunk (ruby 2.3.0dev (2015-01-21 trunk 49282) [x86_64-linux]) at "/home/ew/rrrr/b/i/bin/ruby"
target 2: built (ruby 2.3.0dev (2015-01-21 trunk 49282) [x86_64-linux]) at "/home/ew/ruby/b/i/bin/ruby"

-----------------------------------------------------------
hash_aref_flo

h = {}
strs = (1..10000).to_a.map!(&:to_f)
strs.each { |s| h[s] = s }
50.times { strs.each { |s| h[s] } }

2.1.5	0.057658879086375237
2.1.5	0.05701436009258032
2.1.5	0.0581241431646049
2.1.5	0.05818218016065657
2.1.5	0.05699451011605561
trunk	6.946004607947543
trunk	6.924674273002893
trunk	8.249946656171232
trunk	8.284228298114613
trunk	8.257179390871897
built	0.03704251698218286
built	0.036561502842232585
built	0.03689219383522868
built	0.03630112297832966
built	0.03645375999622047

-----------------------------------------------------------
hash_aref_flo_ident

h = {}.compare_by_identity
strs = (1..10000).to_a.map!(&:to_f)
strs.each { |s| h[s] = s }
50.times { strs.each { |s| h[s] } }

2.1.5	0.042678761994466186
2.1.5	0.04107877588830888
2.1.5	0.04312465596012771
2.1.5	0.043001166079193354
2.1.5	0.042221283074468374
trunk	9.53841691906564
trunk	8.984847767977044
trunk	9.543850363930687
trunk	9.402584770927206
trunk	9.55683896690607
built	0.03262514993548393
built	0.0324752489104867
built	0.03248488996177912
built	0.0327761999797076
built	0.031885297037661076

-----------------------------------------------------------
hash_aref_miss

h = {}
strs = ('a'..'z').to_a.map!(&:freeze)
strs.each { |s| h[s] = s }
strs = ('A'..'Z').to_a
200_000.times { strs.each { |s| h[s] } }

2.1.5	0.5185965250711888
2.1.5	0.5285457829013467
2.1.5	0.5063108801841736
2.1.5	0.495372474193573
2.1.5	0.5173116771038622
trunk	0.4136707920115441
trunk	0.4223632088396698
trunk	0.41807394404895604
trunk	0.43981511797755957
trunk	0.4228058320004493
built	0.4328137410338968
built	0.4213726769667119
built	0.4252174140419811
built	0.44443970802240074
built	0.42979061393998563

-----------------------------------------------------------
hash_aref_str

h = {}
strs = ('a'..'z').to_a.map!(&:freeze)
strs.each { |s| h[s] = s }
200_000.times { strs.each { |s| h[s] } }

2.1.5	0.4787957170046866
2.1.5	0.4674379590433091
2.1.5	0.4685833752155304
2.1.5	0.4803533589001745
2.1.5	0.4808166951406747
trunk	0.39129374315962195
trunk	0.40168298012577
trunk	0.39533682097680867
trunk	0.4013675490859896
trunk	0.40247779292985797
built	0.4094061499927193
built	0.3959489131812006
built	0.40638900408521295
built	0.39190263696946204
built	0.3963621649891138

-----------------------------------------------------------
hash_aref_sym

h = {}
syms = ('a'..'z').to_a
begin
  syms = eval("%i[#{syms.join(' ')}]")
rescue SyntaxError # <= 1.9.3
  syms.map!(&:to_sym)
end
syms.each { |s| h[s] = s }
200_000.times { syms.each { |s| h[s] } }

2.1.5	0.3960708410013467
2.1.5	0.4049839139916003
2.1.5	0.37887499015778303
2.1.5	0.39556407812051475
2.1.5	0.3921978499274701
trunk	0.3128815379459411
trunk	0.3085387230385095
trunk	0.3060462190769613
trunk	0.28886695695109665
trunk	0.29319849889725447
built	0.3166853429283947
built	0.3737580960150808
built	0.5082309539429843
built	0.29229065915569663
built	0.389835735084489

-----------------------------------------------------------
hash_aref_sym_long

h = {}
syms = %w[puts warn syswrite write stat bacon lettuce tomato
some symbols in this array may already be interned  others should not be
hash browns make good breakfast but not cooked using prime numbers
shift for division entries delete_if keys exist?
]
begin
  syms = eval("%i[#{syms.join(' ')}]")
rescue SyntaxError # <= 1.9.3
  syms.map!(&:to_sym)
end
syms.each { |s| h[s] = s }
200_000.times { syms.each { |s| h[s] } }

2.1.5	0.671781568787992
2.1.5	0.6447311348747462
2.1.5	0.9024117519147694
2.1.5	0.647139779990539
2.1.5	0.6085104569792747
trunk	0.5124125410802662
trunk	0.4491119780577719
trunk	0.621321156155318
trunk	0.44987999205477536
trunk	0.5692238509654999
built	0.45835271407850087
built	0.6556747748982161
built	0.4575006559025496
built	0.4646637341938913
built	0.4607272900175303

-----------------------------------------------------------
hash_flatten

h = {}

10000.times do |i|
  h[i] = nil
end

1000.times do
  h.flatten
end

2.1.5	0.5848196281585842
2.1.5	0.573044918011874
2.1.5	0.5758752471301705
2.1.5	0.566153900930658
2.1.5	0.5622547711245716
trunk	0.4369055889546871
trunk	0.41813170397654176
trunk	0.42388757108710706
trunk	0.4205820579081774
trunk	0.4150242938194424
built	0.43742286204360425
built	0.41217766399495304
built	0.4133497339207679
built	0.4095261220354587
built	0.41744197392836213

-----------------------------------------------------------
hash_ident_num

h = {}.compare_by_identity
nums = (1..26).to_a
nums.each { |n| h[n] = n }
200_000.times { nums.each { |n| h[n] } }

2.1.5	0.33398461109027267
2.1.5	0.31960862688720226
2.1.5	0.3586470140144229
2.1.5	0.317992536816746
2.1.5	0.31855493504554033
trunk	0.2674710319843143
trunk	0.2725566599983722
trunk	0.27265908499248326
trunk	0.2690958119928837
trunk	0.28829633980058134
built	0.2762623089365661
built	0.3083010350819677
built	0.3087950819171965
built	0.2704205121845007
built	0.2694335749838501

-----------------------------------------------------------
hash_ident_obj

h = {}.compare_by_identity
objs = 26.times.map { Object.new }
objs.each { |o| h[o] = o }
200_000.times { objs.each { |o| h[o] } }

2.1.5	0.3281495508272201
2.1.5	0.32721969205886126
2.1.5	0.34980491315945983
2.1.5	0.3412753820884973
2.1.5	0.3712129269260913
trunk	0.2888691578991711
trunk	0.28676896495744586
trunk	0.282184419920668
trunk	0.27135920408181846
trunk	0.36504087783396244
built	0.27172754681669176
built	0.26974168699234724
built	0.270940168062225
built	0.26954599702730775
built	0.26955589815042913

-----------------------------------------------------------
hash_ident_str

h = {}.compare_by_identity
strs = ('a'..'z').to_a
strs.each { |s| h[s] = s }
200_000.times { strs.each { |s| h[s] } }

2.1.5	0.3274318401236087
2.1.5	0.33268116088584065
2.1.5	0.32738804002292454
2.1.5	0.3285253301728517
2.1.5	0.3400004249997437
trunk	0.27084569190628827
trunk	0.27467338112182915
trunk	0.27227868395857513
trunk	0.2654467918910086
trunk	0.2699620728380978
built	0.2726242409553379
built	0.26660885219462216
built	0.2702424409799278
built	0.2730282109696418
built	0.27350158896297216

-----------------------------------------------------------
hash_ident_sym

h = {}.compare_by_identity
syms = ('a'..'z').to_a.map(&:to_sym)
syms.each { |s| h[s] = s }
200_000.times { syms.each { |s| h[s] } }

2.1.5	0.3401395189575851
2.1.5	0.34246800001710653
2.1.5	0.3501956439577043
2.1.5	0.34996579494327307
2.1.5	0.3401323112193495
trunk	0.329773924080655
trunk	0.28319185483269393
trunk	0.30268601700663567
trunk	0.2728322478942573
trunk	0.28968086605891585
built	0.2882633430417627
built	0.283954591024667
built	0.28415460092946887
built	0.2840782618150115
built	0.2823355570435524

-----------------------------------------------------------
hash_keys

h = {}

10000.times do |i|
  h[i] = nil
end

5000.times do
  h.keys
end

2.1.5	0.21738848998211324
2.1.5	0.2148919168394059
2.1.5	0.21466855495236814
2.1.5	0.21460769488476217
2.1.5	0.21692011412233114
trunk	0.22757983906194568
trunk	0.22662106296047568
trunk	0.22675147117115557
trunk	0.22718775598332286
trunk	0.22616718895733356
built	0.2262740060687065
built	0.22702662297524512
built	0.226099916966632
built	0.227050760993734
built	0.22707261005416512

-----------------------------------------------------------
hash_shift

h = {}

10000.times do |i|
  h[i] = nil
end

50000.times do
  k, v = h.shift
  h[k] = v
end

2.1.5	0.02096499316394329
2.1.5	0.020775595912709832
2.1.5	0.020838676020503044
2.1.5	0.020787448156625032
2.1.5	0.020740390988066792
trunk	0.01992398709990084
trunk	0.02072413405403495
trunk	0.02083008410409093
trunk	0.019860764965415
trunk	0.01985550415702164
built	0.02002101205289364
built	0.020051329163834453
built	0.01976338098756969
built	0.01977885700762272
built	0.01977451518177986

-----------------------------------------------------------
hash_values

h = {}

10000.times do |i|
  h[i] = nil
end

5000.times do
  h.values
end

2.1.5	0.22747167805209756
2.1.5	0.22644079895690084
2.1.5	0.22772416891530156
2.1.5	0.22755920886993408
2.1.5	0.22625517891719937
trunk	0.23576064291410148
trunk	0.23579940106719732
trunk	0.2356541461776942
trunk	0.23711273400112987
trunk	0.23622178798541427
built	0.23551301704719663
built	0.2357158239465207
built	0.23589896084740758
built	0.2378278709948063
built	0.23530605691485107

-----------------------------------------------------------
loop_whileloop2

i = 0
while i< 6_000_000 # benchmark loop 2
  i += 1
end

2.1.5	0.10240712785162032
2.1.5	0.10216359398327768
2.1.5	0.10118183610029519
2.1.5	0.102117181988433
2.1.5	0.10222429991699755
trunk	0.10222484194673598
trunk	0.10204781382344663
trunk	0.10202976898290217
trunk	0.10203393502160907
trunk	0.1020544720813632
built	0.10220383806154132
built	0.10214726789854467
built	0.10218349890783429
built	0.1033462721388787
built	0.10914223198778927

-----------------------------------------------------------
vm2_bighash

i = 0
while i<60_000 # benchmark loop 2
  i += 1
  a = {0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6, 7=>7, 8=>8, 9=>9, 10=>10,
  11=>11, 12=>12, 13=>13, 14=>14, 15=>15, 16=>16, 17=>17, 18=>18, 19=>19,
  20=>20, 21=>21, 22=>22, 23=>23, 24=>24, 25=>25, 26=>26, 27=>27, 28=>28,
  29=>29, 30=>30, 31=>31, 32=>32, 33=>33, 34=>34, 35=>35, 36=>36, 37=>37,
  38=>38, 39=>39, 40=>40, 41=>41, 42=>42, 43=>43, 44=>44, 45=>45, 46=>46,
  47=>47, 48=>48, 49=>49, 50=>50, 51=>51, 52=>52, 53=>53, 54=>54, 55=>55,
  56=>56, 57=>57, 58=>58, 59=>59, 60=>60, 61=>61, 62=>62, 63=>63, 64=>64,
  65=>65, 66=>66, 67=>67, 68=>68, 69=>69, 70=>70, 71=>71, 72=>72, 73=>73,
  74=>74, 75=>75, 76=>76, 77=>77, 78=>78, 79=>79, 80=>80, 81=>81, 82=>82,
  83=>83, 84=>84, 85=>85, 86=>86, 87=>87, 88=>88, 89=>89, 90=>90, 91=>91,
  92=>92, 93=>93, 94=>94, 95=>95, 96=>96, 97=>97, 98=>98, 99=>99, 100=>100,
  101=>101, 102=>102, 103=>103, 104=>104, 105=>105, 106=>106, 107=>107,
  108=>108, 109=>109, 110=>110, 111=>111, 112=>112, 113=>113, 114=>114,
  115=>115, 116=>116, 117=>117, 118=>118, 119=>119, 120=>120, 121=>121,
  122=>122, 123=>123, 124=>124, 125=>125, 126=>126, 127=>127, 128=>128,
  129=>129, 130=>130, 131=>131, 132=>132, 133=>133, 134=>134, 135=>135,
  136=>136, 137=>137, 138=>138, 139=>139, 140=>140, 141=>141, 142=>142,
  143=>143, 144=>144, 145=>145, 146=>146, 147=>147, 148=>148, 149=>149,
  150=>150, 151=>151, 152=>152, 153=>153, 154=>154, 155=>155, 156=>156,
  157=>157, 158=>158, 159=>159, 160=>160, 161=>161, 162=>162, 163=>163,
  164=>164, 165=>165, 166=>166, 167=>167, 168=>168, 169=>169, 170=>170,
  171=>171, 172=>172, 173=>173, 174=>174, 175=>175, 176=>176, 177=>177,
  178=>178, 179=>179, 180=>180, 181=>181, 182=>182, 183=>183, 184=>184,
  185=>185, 186=>186, 187=>187, 188=>188, 189=>189, 190=>190, 191=>191,
  192=>192, 193=>193, 194=>194, 195=>195, 196=>196, 197=>197, 198=>198,
  199=>199, 200=>200, 201=>201, 202=>202, 203=>203, 204=>204, 205=>205,
  206=>206, 207=>207, 208=>208, 209=>209, 210=>210, 211=>211, 212=>212,
  213=>213, 214=>214, 215=>215, 216=>216, 217=>217, 218=>218, 219=>219,
  220=>220, 221=>221, 222=>222, 223=>223, 224=>224, 225=>225, 226=>226,
  227=>227, 228=>228, 229=>229, 230=>230, 231=>231, 232=>232, 233=>233,
  234=>234, 235=>235, 236=>236, 237=>237, 238=>238, 239=>239, 240=>240,
  241=>241, 242=>242, 243=>243, 244=>244, 245=>245, 246=>246, 247=>247,
  248=>248, 249=>249, 250=>250, 251=>251, 252=>252, 253=>253, 254=>254,
  255=>255, 256=>256, 257=>257, 258=>258, 259=>259, 260=>260, 261=>261,
  262=>262, 263=>263, 264=>264, 265=>265, 266=>266, 267=>267, 268=>268,
  269=>269, 270=>270, 271=>271, 272=>272, 273=>273, 274=>274, 275=>275,
  276=>276, 277=>277, 278=>278, 279=>279, 280=>280, 281=>281, 282=>282,
  283=>283, 284=>284, 285=>285, 286=>286, 287=>287, 288=>288, 289=>289,
  290=>290, 291=>291, 292=>292, 293=>293, 294=>294, 295=>295, 296=>296,
  297=>297, 298=>298, 299=>299, 300=>300, 301=>301, 302=>302, 303=>303,
  304=>304, 305=>305, 306=>306, 307=>307, 308=>308, 309=>309, 310=>310,
  311=>311, 312=>312, 313=>313, 314=>314, 315=>315, 316=>316, 317=>317,
  318=>318, 319=>319, 320=>320, 321=>321, 322=>322, 323=>323, 324=>324,
  325=>325, 326=>326, 327=>327, 328=>328, 329=>329, 330=>330, 331=>331,
  332=>332, 333=>333, 334=>334, 335=>335, 336=>336, 337=>337, 338=>338,
  339=>339, 340=>340, 341=>341, 342=>342, 343=>343, 344=>344, 345=>345,
  346=>346, 347=>347, 348=>348, 349=>349, 350=>350, 351=>351, 352=>352,
  353=>353, 354=>354, 355=>355, 356=>356, 357=>357, 358=>358, 359=>359,
  360=>360, 361=>361, 362=>362, 363=>363, 364=>364, 365=>365, 366=>366,
  367=>367, 368=>368, 369=>369, 370=>370, 371=>371, 372=>372, 373=>373,
  374=>374, 375=>375, 376=>376, 377=>377, 378=>378, 379=>379, 380=>380,
  381=>381, 382=>382, 383=>383, 384=>384, 385=>385, 386=>386, 387=>387,
  388=>388, 389=>389, 390=>390, 391=>391, 392=>392, 393=>393, 394=>394,
  395=>395, 396=>396, 397=>397, 398=>398, 399=>399, 400=>400, 401=>401,
  402=>402, 403=>403, 404=>404, 405=>405, 406=>406, 407=>407, 408=>408,
  409=>409, 410=>410, 411=>411, 412=>412, 413=>413, 414=>414, 415=>415,
  416=>416, 417=>417, 418=>418, 419=>419, 420=>420, 421=>421, 422=>422,
  423=>423, 424=>424, 425=>425, 426=>426, 427=>427, 428=>428, 429=>429,
  430=>430, 431=>431, 432=>432, 433=>433, 434=>434, 435=>435, 436=>436,
  437=>437, 438=>438, 439=>439, 440=>440, 441=>441, 442=>442, 443=>443,
  444=>444, 445=>445, 446=>446, 447=>447, 448=>448, 449=>449, 450=>450,
  451=>451, 452=>452, 453=>453, 454=>454, 455=>455, 456=>456, 457=>457,
  458=>458, 459=>459, 460=>460, 461=>461, 462=>462, 463=>463, 464=>464,
  465=>465, 466=>466, 467=>467, 468=>468, 469=>469, 470=>470, 471=>471,
  472=>472, 473=>473, 474=>474, 475=>475, 476=>476, 477=>477, 478=>478,
  479=>479, 480=>480, 481=>481, 482=>482, 483=>483, 484=>484, 485=>485,
  486=>486, 487=>487, 488=>488, 489=>489, 490=>490, 491=>491, 492=>492,
  493=>493, 494=>494, 495=>495, 496=>496, 497=>497, 498=>498, 499=>499,
  500=>500,}
end

2.1.5	5.074784496799111
2.1.5	5.067482308018953
2.1.5	5.065873316023499
2.1.5	5.043999932939187
2.1.5	5.047461024019867
trunk	3.8931863731704652
trunk	3.830156187992543
trunk	3.827827933942899
trunk	3.790046467911452
trunk	3.8176851999014616
built	3.7921502760145813
built	3.7857852808665484
built	3.810252371011302
built	3.839827809948474
built	3.8486109089571983

-----------------------------------------------------------
raw data:

[["hash_aref_flo",
  [[0.057658879086375237,
    0.05701436009258032,
    0.0581241431646049,
    0.05818218016065657,
    0.05699451011605561],
   [6.946004607947543,
    6.924674273002893,
    8.249946656171232,
    8.284228298114613,
    8.257179390871897],
   [0.03704251698218286,
    0.036561502842232585,
    0.03689219383522868,
    0.03630112297832966,
    0.03645375999622047]]],
 ["hash_aref_flo_ident",
  [[0.042678761994466186,
    0.04107877588830888,
    0.04312465596012771,
    0.043001166079193354,
    0.042221283074468374],
   [9.53841691906564,
    8.984847767977044,
    9.543850363930687,
    9.402584770927206,
    9.55683896690607],
   [0.03262514993548393,
    0.0324752489104867,
    0.03248488996177912,
    0.0327761999797076,
    0.031885297037661076]]],
 ["hash_aref_miss",
  [[0.5185965250711888,
    0.5285457829013467,
    0.5063108801841736,
    0.495372474193573,
    0.5173116771038622],
   [0.4136707920115441,
    0.4223632088396698,
    0.41807394404895604,
    0.43981511797755957,
    0.4228058320004493],
   [0.4328137410338968,
    0.4213726769667119,
    0.4252174140419811,
    0.44443970802240074,
    0.42979061393998563]]],
 ["hash_aref_str",
  [[0.4787957170046866,
    0.4674379590433091,
    0.4685833752155304,
    0.4803533589001745,
    0.4808166951406747],
   [0.39129374315962195,
    0.40168298012577,
    0.39533682097680867,
    0.4013675490859896,
    0.40247779292985797],
   [0.4094061499927193,
    0.3959489131812006,
    0.40638900408521295,
    0.39190263696946204,
    0.3963621649891138]]],
 ["hash_aref_sym",
  [[0.3960708410013467,
    0.4049839139916003,
    0.37887499015778303,
    0.39556407812051475,
    0.3921978499274701],
   [0.3128815379459411,
    0.3085387230385095,
    0.3060462190769613,
    0.28886695695109665,
    0.29319849889725447],
   [0.3166853429283947,
    0.3737580960150808,
    0.5082309539429843,
    0.29229065915569663,
    0.389835735084489]]],
 ["hash_aref_sym_long",
  [[0.671781568787992,
    0.6447311348747462,
    0.9024117519147694,
    0.647139779990539,
    0.6085104569792747],
   [0.5124125410802662,
    0.4491119780577719,
    0.621321156155318,
    0.44987999205477536,
    0.5692238509654999],
   [0.45835271407850087,
    0.6556747748982161,
    0.4575006559025496,
    0.4646637341938913,
    0.4607272900175303]]],
 ["hash_flatten",
  [[0.5848196281585842,
    0.573044918011874,
    0.5758752471301705,
    0.566153900930658,
    0.5622547711245716],
   [0.4369055889546871,
    0.41813170397654176,
    0.42388757108710706,
    0.4205820579081774,
    0.4150242938194424],
   [0.43742286204360425,
    0.41217766399495304,
    0.4133497339207679,
    0.4095261220354587,
    0.41744197392836213]]],
 ["hash_ident_num",
  [[0.33398461109027267,
    0.31960862688720226,
    0.3586470140144229,
    0.317992536816746,
    0.31855493504554033],
   [0.2674710319843143,
    0.2725566599983722,
    0.27265908499248326,
    0.2690958119928837,
    0.28829633980058134],
   [0.2762623089365661,
    0.3083010350819677,
    0.3087950819171965,
    0.2704205121845007,
    0.2694335749838501]]],
 ["hash_ident_obj",
  [[0.3281495508272201,
    0.32721969205886126,
    0.34980491315945983,
    0.3412753820884973,
    0.3712129269260913],
   [0.2888691578991711,
    0.28676896495744586,
    0.282184419920668,
    0.27135920408181846,
    0.36504087783396244],
   [0.27172754681669176,
    0.26974168699234724,
    0.270940168062225,
    0.26954599702730775,
    0.26955589815042913]]],
 ["hash_ident_str",
  [[0.3274318401236087,
    0.33268116088584065,
    0.32738804002292454,
    0.3285253301728517,
    0.3400004249997437],
   [0.27084569190628827,
    0.27467338112182915,
    0.27227868395857513,
    0.2654467918910086,
    0.2699620728380978],
   [0.2726242409553379,
    0.26660885219462216,
    0.2702424409799278,
    0.2730282109696418,
    0.27350158896297216]]],
 ["hash_ident_sym",
  [[0.3401395189575851,
    0.34246800001710653,
    0.3501956439577043,
    0.34996579494327307,
    0.3401323112193495],
   [0.329773924080655,
    0.28319185483269393,
    0.30268601700663567,
    0.2728322478942573,
    0.28968086605891585],
   [0.2882633430417627,
    0.283954591024667,
    0.28415460092946887,
    0.2840782618150115,
    0.2823355570435524]]],
 ["hash_keys",
  [[0.21738848998211324,
    0.2148919168394059,
    0.21466855495236814,
    0.21460769488476217,
    0.21692011412233114],
   [0.22757983906194568,
    0.22662106296047568,
    0.22675147117115557,
    0.22718775598332286,
    0.22616718895733356],
   [0.2262740060687065,
    0.22702662297524512,
    0.226099916966632,
    0.227050760993734,
    0.22707261005416512]]],
 ["hash_shift",
  [[0.02096499316394329,
    0.020775595912709832,
    0.020838676020503044,
    0.020787448156625032,
    0.020740390988066792],
   [0.01992398709990084,
    0.02072413405403495,
    0.02083008410409093,
    0.019860764965415,
    0.01985550415702164],
   [0.02002101205289364,
    0.020051329163834453,
    0.01976338098756969,
    0.01977885700762272,
    0.01977451518177986]]],
 ["hash_values",
  [[0.22747167805209756,
    0.22644079895690084,
    0.22772416891530156,
    0.22755920886993408,
    0.22625517891719937],
   [0.23576064291410148,
    0.23579940106719732,
    0.2356541461776942,
    0.23711273400112987,
    0.23622178798541427],
   [0.23551301704719663,
    0.2357158239465207,
    0.23589896084740758,
    0.2378278709948063,
    0.23530605691485107]]],
 ["loop_whileloop2",
  [[0.10240712785162032,
    0.10216359398327768,
    0.10118183610029519,
    0.102117181988433,
    0.10222429991699755],
   [0.10222484194673598,
    0.10204781382344663,
    0.10202976898290217,
    0.10203393502160907,
    0.1020544720813632],
   [0.10220383806154132,
    0.10214726789854467,
    0.10218349890783429,
    0.1033462721388787,
    0.10914223198778927]]],
 ["vm2_bighash",
  [[5.074784496799111,
    5.067482308018953,
    5.065873316023499,
    5.043999932939187,
    5.047461024019867],
   [3.8931863731704652,
    3.830156187992543,
    3.827827933942899,
    3.790046467911452,
    3.8176851999014616],
   [3.7921502760145813,
    3.7857852808665484,
    3.810252371011302,
    3.839827809948474,
    3.8486109089571983]]]]

Elapsed time: 210.977786787 (sec)
-----------------------------------------------------------
benchmark results:
minimum results in each 5 measurements.
Execution time (sec)
name	2.1.5	trunk	built
hash_aref_flo	0.057	6.925	0.036
hash_aref_flo_ident	0.041	8.985	0.032
hash_aref_miss	0.495	0.414	0.421
hash_aref_str	0.467	0.391	0.392
hash_aref_sym	0.379	0.289	0.292
hash_aref_sym_long	0.609	0.449	0.458
hash_flatten	0.562	0.415	0.410
hash_ident_num	0.318	0.267	0.269
hash_ident_obj	0.327	0.271	0.270
hash_ident_str	0.327	0.265	0.267
hash_ident_sym	0.340	0.273	0.282
hash_keys	0.215	0.226	0.226
hash_shift	0.021	0.020	0.020
hash_values	0.226	0.236	0.235
loop_whileloop2	0.101	0.102	0.102
vm2_bighash*	4.943	3.688	3.684

Speedup ratio: compare with the result of `2.1.5' (greater is better)
name	trunk	built
hash_aref_flo	0.008	1.570
hash_aref_flo_ident	0.005	1.288
hash_aref_miss	1.198	1.176
hash_aref_str	1.195	1.193
hash_aref_sym	1.312	1.296
hash_aref_sym_long	1.355	1.330
hash_flatten	1.355	1.373
hash_ident_num	1.189	1.180
hash_ident_obj	1.206	1.214
hash_ident_str	1.233	1.228
hash_ident_sym	1.247	1.205
hash_keys	0.949	0.949
hash_shift	1.045	1.049
hash_values	0.960	0.962
loop_whileloop2	0.992	0.991
vm2_bighash*	1.340	1.342

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-21 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 22:03 [PATCH] fix flonum hashing regression from r45384 Eric Wong
2015-01-21 22:15 ` flonum hash fix regression benchmark results Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).