[ruby-dev:49354] [Ruby trunk - Feature #11688] [Open] Struct and OpenStruct will be able to chain the Hash#dig Array#dig
From:
nobu@...
Date:
2015-11-16 09:45:57 UTC
List:
ruby-dev #49354
Issue #11688 has been updated by Nobuyoshi Nakada.
File bm_dig.rb added
Status changed from Closed to Open
I benchmarked with the attached script.
| user | system | total | real
-------------------------|---------:|---------:|---------:|---------:
Hash only(C) | 0.030000 | 0.000000 | 0.030000 | 0.026955
Hash only(Ruby) | 0.810000 | 0.040000 | 0.850000 | 0.873564
Hash+Array (C) | 0.040000 | 0.010000 | 0.050000 | 0.048672
Hash+Array (Ruby) | 1.670000 | 0.060000 | 1.730000 | 1.777769
OpenStruct (C) | 0.940000 | 0.040000 | 0.980000 | 1.001595
OpenStruct (Ruby) | 0.930000 | 0.040000 | 0.970000 | 0.989792
OpenStruct+Array (C) | 1.040000 | 0.030000 | 1.070000 | 1.093703
OpenStruct+Array (Ruby) | 1.840000 | 0.030000 | 1.870000 | 1.882345
Mix Hash (C) | 0.030000 | 0.000000 | 0.030000 | 0.034446
Mix Hash (RUBY) | 1.770000 | 0.040000 | 1.810000 | 1.826980
Mix OpenStruct (C) | 1.470000 | 0.030000 | 1.500000 | 1.516417
Mix OpenStruct (Ruby) | 1.920000 | 0.050000 | 1.970000 | 1.987407
----------------------------------------
Feature #11688: Struct and OpenStruct will be able to chain the Hash#dig Array#dig
https://bugs.ruby-lang.org/issues/11688#change-54875
* Author: Kenichi Kamiya
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
Struct and OpenStruct are rejected with #dig? I couldn't get from [Feature #11643]
[patch](https://github.com/ruby/ruby/pull/1097)
---Files--------------------------------
bm_dig.rb (1.88 KB)
--
https://bugs.ruby-lang.org/