Created
April 11, 2011 05:34
-
-
Save jackowayed/913106 to your computer and use it in GitHub Desktop.
Benchmarks your CS 107 assignment against the solution
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
#!/usr/bin/env ruby | |
require 'open3' | |
# Ruby doesn't realize how AFS works and is thus complaining about the | |
# executable it's running being world writable. | |
# It complains to stderr, so just suppress that. | |
$stderr.reopen('/dev/null', 'w') | |
def test(command) | |
a,b,stderr = Open3.popen3 command | |
stderr.read =~ /(\d+:\d+\.\d+)elapsed/ | |
$1 | |
end | |
ARGV.each do |file| | |
them = test "time /usr/class/cs107/samples/assign1/reassemble_soln #{file}" | |
us = test "time ./reassemble #{file}" | |
puts file, "them: #{them}", "us: #{us}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment