Skip to content

Instantly share code, notes, and snippets.

@joho
Created April 27, 2009 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joho/102417 to your computer and use it in GitHub Desktop.
Save joho/102417 to your computer and use it in GitHub Desktop.
TEST_INPUT_PATH = '/Users/joho/Desktop/Grand Designs S09E10.avi'
TIMES_TO_TEST = 10
start = Time.now
TIMES_TO_TEST.times do
puts "start"
File.open 'test.avi', 'w' do |out_file|
File.open TEST_INPUT_PATH, 'r' do |in_file|
out_file.write in_file.read
end
end
`rm test.avi`
end
puts Time.now - start
start = Time.now
TIMES_TO_TEST.times do
puts "start 2"
File.open 'test2.avi', 'w' do |out_file|
File.open TEST_INPUT_PATH, 'r' do |in_file|
while out_file.syswrite((in_file.sysread(16_384) rescue nil) > 0
end
end
end
`rm test2.avi`
end
puts Time.now - start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment