Last active
July 31, 2017 03:50
-
-
Save SamSaffron/f43996d5989cefbfbf69e9557ef13b23 to your computer and use it in GitHub Desktop.
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
i = 0 | |
def parse_param(s) | |
unless block_given? | |
return enum_for(__method__, s) | |
end | |
yield "a" | |
nil | |
end | |
def parse_line(line) | |
parts = parse_param(';' + line) | |
parts.next | |
end | |
while i < 10_000 | |
Thread.new { parse_line("Content-Type:application/json; charset=ISO-8859-1") }.join | |
slots = GC.stat[:heap_live_slots] | |
_,rss = `ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split.map(&:to_i) | |
puts "slots #{slots} #{i+=1} threads #{Thread.list.count} rss #{rss}" | |
end | |
puts "done #{RUBY_VERSION}" | |
gets | |
## | |
# Ruby 2.3.3 | |
# slots 19183, rss 36980 | |
# Ruby 2.4.1 | |
# slots 14448, rss 132572 | |
# | |
# Ruby latest | |
# slots 13783 rss 257108 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment