Skip to content

Instantly share code, notes, and snippets.

@itsderek23
Created April 18, 2016 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save itsderek23/b9196051f5139820bdce10a86fc8a4c8 to your computer and use it in GitHub Desktop.
Save itsderek23/b9196051f5139820bdce10a86fc8a4c8 to your computer and use it in GitHub Desktop.
require 'get_process_mem'
require 'rusage' # gem install rusage
require 'benchmark'
n = 2000
gpm = GetProcessMem.new
Benchmark.bm(10) do |x|
x.report("gpm:") { n.times do gpm.mb end }
x.report("rusage:") { n.times do Process.rusage.maxrss end }
end
gpm.mb
Process.rusage.maxrss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment