:"string" is significantly slower to generate the object than :string
---------------------------------------------------------------------
Key: JRUBY-4918
URL: http://jira.codehaus.org/browse/JRUBY-4918
Project: JRuby
Issue Type: Improvement
Components: Core Classes/Modules, Parser
Affects Versions: JRuby 1.5.1, JRuby 1.5
Environment: github trunk, Java 6u20, Mac OS X 10.6.4
Reporter: Hiro Asari
As reported in http://d.hatena.ne.jp/whiteleaf/20100702/1278062359, in JRuby,
{{:"abc"}} is much slower to be generated than {{:abc}}.
I reproduce the benchmark here:
{code}
require "benchmark"
def test_symbol(sym)
a = sym
end
Benchmark.bm { |bm|
bm.report("(1)") {
10000000.times {
test_symbol(:abc)
}
}
bm.report("(2)") {
10000000.times {
test_symbol(:"abc")
}
}
bm.report("(3)") {
sym = :abc
10000000.times {
test_symbol(sym)
}
}
}
{code}
On my machine, the figures are:
{noformat}
$ jruby temp/quoted_symbol.rb
user system total real
(1) 0.792000 0.000000 0.792000 ( 0.737000)
(2) 4.214000 0.000000 4.214000 ( 4.215000)
(3) 0.768000 0.000000 0.768000 ( 0.768000)
{noformat}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email