Created
January 7, 2026 10:15
-
-
Save nobu/f373134644f5c7214a6b15decaea69ef to your computer and use it in GitHub Desktop.
Access to reserved name argument
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user system total real | |
| case_hash 0.068478 0.003698 0.072176 ( 0.072223) | |
| case_binding 0.220886 0.014623 0.235509 ( 0.235632) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user system total real | |
| case_hash 0.065353 0.004143 0.069496 ( 0.069540) | |
| case_binding 0.184500 0.018979 0.203479 ( 0.203601) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'benchmark' | |
| N = 1000_000 | |
| def case_hash(case:) | |
| {case:}[:case] | |
| end | |
| def case_binding(case:) | |
| binding.local_variable_get(:case) | |
| end | |
| Benchmark.bm(12) do |bm| | |
| bm.report("case_hash") {N.times {case_hash(case: :ok)}} | |
| bm.report("case_binding") {N.times {case_binding(case: :ok)}} | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment