-
jobs=1 (7 minutes 32 seconds)
-
jobs=2 (4 minutes 31 seconds)
-
jobs=4 (4 minutes 20 seconds)
-
new (2 minutes 7 seconds)
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 = 10_000_000 | |
| Benchmark.bmbm do |test| | |
| test.report 'if not' do | |
| n.times do | |
| if not 0.nil? | |
| 0 | |
| end |
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' | |
| array_iterate = (1..10_000_000).to_a | |
| array_shift = array_iterate.dup | |
| Benchmark.bmbm do |test| | |
| # this assumes you can destroy the given array | |
| test.report 'using shift' do | |
| for i in array_shift |
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' | |
| array_iterate = (1..10_000_000).to_a | |
| array_shift = array_iterate.dup | |
| Benchmark.bmbm do |test| | |
| # this assumes you can destroy the given array | |
| test.report 'using shift' do | |
| for i in array_shift |
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 'rubygems' | |
| gem 'minitest' | |
| require 'minitest/autorun' | |
| require 'minitest/benchmark' | |
| class Bench < MiniTest::Unit::TestCase | |
| def self.test_order | |
| :alpha | |
| end |
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 'rake/compiletask' | |
| Rake::CompileTask.new(:fast_compile) do |t| | |
| t.files = FileList["lib/**/*.rb"] | |
| t.verbose = true | |
| end | |
| desc 'AOT compile source files' | |
| task :slow_compile do | |
| start_time = Time.now | |
| FileList["lib/**/*.rb"].each do |source| |
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 = 100_000 | |
| Benchmark.bmbm do |test| | |
| test.report 'implicit block with yield' do | |
| def test | |
| yield if block_given? | |
| end | |
| n.times do test {} end |
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 'json' | |
| require 'rubygems' | |
| require 'restclient' | |
| # setup db | |
| DB = 'http://127.0.0.1:5984/test' | |
| RestClient.delete DB rescue nil | |
| RestClient.put DB, {}.to_json | |
| # setup a document |
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 'rubygems' | |
| gem 'minitest', '>= 2.2' | |
| require 'minitest/autorun' | |
| require 'minitest/benchmark' | |
| class BenchMethodToProc < MiniTest::Unit::TestCase | |
| def self.test_order | |
| :alpha | |
| end |
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 'rubygems' | |
| gem 'minitest', '>= 2.3.1' | |
| require 'minitest/autorun' | |
| require 'minitest/benchmark' | |
| require 'json' | |
| framework 'Foundation' | |
| class Bench < MiniTest::Unit::TestCase | |
| def self.order | |
| :alpha |
OlderNewer