Created
March 22, 2012 05:46
-
-
Save rondale-sc/2156488 to your computer and use it in GitHub Desktop.
string-theory
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
| # ./test_single_or_double.rb | |
| require './stats.rb' | |
| test_strings = {:double => 'ruby -e "start_time = Time.now; 100_000.times { \"a\" }; puts Time.now - start_time"', | |
| :single => "ruby -e \"start_time = Time.now; 100_000.times { 'a' }; puts Time.now - start_time\""} | |
| sr = 1000.times.inject([]) {|memo, result| memo << `#{test_strings[:single]}`.strip } | |
| dr = 1000.times.inject([]) {|memo, result| memo << `#{test_strings[:double]}`.strip } | |
| single_quotes = Stats.new(sr) | |
| double_quotes = Stats.new(dr) | |
| single_quotes.to_csv("/path/to/file/single_quote_#{RUBY_VERSION}.csv") | |
| double_quotes.to_csv("/path/to/file/double_quote_#{RUBY_VERSION}.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment