$ ruby test_before.rb # before patch
3.7357151369942585
$ ruby test.rb # after patch
1.25253341899951923.7357151369942585 / 1.2525334189995192 * 1000000 => 2982527.3164992435 times faster!
| require 'benchmark' | |
| str = 'a' * 500_000_000 | |
| begin | |
| str.a | |
| rescue => ex | |
| p Benchmark.realtime {1000000.times {ex.message} } | |
| end |
| require 'benchmark' | |
| str = 'a' * 500_000_000 | |
| begin | |
| str.a | |
| rescue => ex | |
| p Benchmark.realtime {ex.message } | |
| end |