-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide Benchmark.quick_compare to quickly compare methods on an obje…
…ct (#134) * Provide Benchmark.quick_compare to quickly compare methods on an object * Move quick_compare to Kernel for more flexible usage * New approach * Splat methods, send all options to Job * Tests * Fix variable shadow --------- Co-authored-by: Nate Berkopec <[email protected]>
- Loading branch information
1 parent
a2c863d
commit f66045d
Showing
4 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'benchmark/ips' | ||
|
||
def add | ||
1 + 1 | ||
end | ||
|
||
def sub | ||
2 - 1 | ||
end | ||
|
||
Benchmark.ips_quick(:add, :sub, warmup: 1, time: 1) | ||
|
||
h = {} | ||
|
||
Benchmark.ips_quick(:size, :empty?, on: h) |
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
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