-
-
Save havenwood/8f4e4ee03aa79549caf0 to your computer and use it in GitHub Desktop.
{} vs Hash.new
This file contains 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
>> Benchmark.ips do |ips| | |
| ips.report('literal') { {} } | |
| ips.report('longform') { Hash.new } | |
| end | |
Calculating ------------------------------------- | |
literal 173.498k i/100ms | |
longform 98.332k i/100ms | |
------------------------------------------------- | |
literal 9.825M (± 6.7%) i/s - 48.926M | |
longform 1.815M (±32.7%) i/s - 7.768M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment