Created
February 2, 2015 05:42
-
-
Save tgxworld/d4f1469feeb000478c43 to your computer and use it in GitHub Desktop.
bm_io_file_read_memoy
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
mem_start = `ps -o rss= -p #{$$}`.to_i | |
# | |
# Seek and Read file. | |
# | |
require 'tempfile' | |
max = 200_000 | |
str = "Hello world! " * 1000 | |
f = Tempfile.new('yarv-benchmark') | |
f.write str | |
max.times{ | |
f.seek 0 | |
f.read | |
} | |
mem_end = `ps -o rss= -p #{$$}`.to_i | |
puts mem_end - mem_start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment