15 lines
		
	
	
		
			386 B
		
	
	
	
		
			Ruby
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			386 B
		
	
	
	
		
			Ruby
		
	
	
		
			Executable File
		
	
	
| #!/usr/bin/env ruby
 | |
| require 'benchmark/ips'
 | |
| 
 | |
| def str
 | |
|   'http://baruco.org/2014/some-talk-with-some-amount-of-value'
 | |
| end
 | |
| 
 | |
| Benchmark.ips do |x|
 | |
|   x.report('#tr')    { str.tr('some', 'a')    }
 | |
|   x.report('#gsub')  { str.gsub('some', 'a')  }
 | |
|   x.report('#gsub!') { str.gsub!('some', 'a') }
 | |
|   x.report('#sub')   { str.sub('some', 'a')   }
 | |
|   x.report('#sub!')  { str.sub!('some', 'a')  }
 | |
| end
 |