I
Iñaki Baz Castillo
Hi, a simple benchmark:
Benchmark.realtime { 1000000.times { @m =3D Hash.new } }
=3D> 0.6552023887634277
Benchmark.realtime { 1000000.times { @m =3D {} } }
=3D> 0.17668819427490234
I would like to know why {} is so much faster. I can understand that
Hash.initialize method must inspect is an argument is given and so, is
just due to it?
Thanks.
--=20
I=C3=B1aki Baz Castillo
<[email protected]>
Benchmark.realtime { 1000000.times { @m =3D Hash.new } }
=3D> 0.6552023887634277
Benchmark.realtime { 1000000.times { @m =3D {} } }
=3D> 0.17668819427490234
I would like to know why {} is so much faster. I can understand that
Hash.initialize method must inspect is an argument is given and so, is
just due to it?
Thanks.
--=20
I=C3=B1aki Baz Castillo
<[email protected]>