From: "tmm1 (Aman Gupta)" Date: 2013-12-07T17:32:18+09:00 Subject: [ruby-core:58943] [ruby-trunk - misc #9188] r43870 make benchmark/bm_so_k_nucleotide.rb slow Issue #9188 has been updated by tmm1 (Aman Gupta). After a few more false starts in the compiler, I ended up with the following patch to the parser. diff --git a/parse.y b/parse.y index 8207ad7..4629a60 100644 --- a/parse.y +++ b/parse.y @@ -4912,7 +4912,11 @@ assocs : assoc assoc : arg_value tASSOC arg_value { /*%%%*/ - $$ = list_append(NEW_LIST($1), $3); + if (nd_type($1) == NODE_STR) { + $$ = list_append(NEW_LIST(NEW_LIT(rb_fstring($1->nd_lit))), $3); + } else { + $$ = list_append(NEW_LIST($1), $3); + } /*% $$ = dispatch2(assoc_new, $1, $3); %*/ diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 6aaba46..42429b4 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -209,10 +209,11 @@ class TestHash < Test::Unit::TestCase assert_equal(256, h[z]) end - def test_ASET_string + def test_fstring_literal_key a = {"ABC" => :t} b = {"ABC" => :t} assert_same a.keys[0], b.keys[0] + assert_same "ABC".freeze, a.keys[0] end def test_EQUAL # '==' ---------------------------------------- misc #9188: r43870 make benchmark/bm_so_k_nucleotide.rb slow https://bugs.ruby-lang.org/issues/9188#change-43493 Author: authorNari (Narihiro Nakamura) Status: Open Priority: Normal Assignee: tmm1 (Aman Gupta) Category: core Target version: current: 2.1.0 Hi. I think r43870 make benchmark/bm_so_k_nucleotide.rb slow. r43870 % time ./miniruby ./benchmark/bm_so_k_nucleotide.rb ./miniruby ./benchmark/bm_so_k_nucleotide.rb 1.70s user 0.01s system 99% cpu 1.718 total r43869 % time ./miniruby ./benchmark/bm_so_k_nucleotide.rb ./miniruby ./benchmark/bm_so_k_nucleotide.rb 1.52s user 0.03s system 99% cpu 1.559 total -- http://bugs.ruby-lang.org/