Skip to content

Instantly share code, notes, and snippets.

@tenderlove tenderlove/before.txt
Last active Aug 29, 2015

Embed
What would you like to do?
memory usage and performance on RubyGems binstubs where 100k gems are installed
[aaron@TC rubygems (master)]$ GEM_HOME=100k_gems GEM_PATH=100k_gems ruby -I lib:~/git/allocation_tracer/lib:. -rmem_usage 100k_gems/bin/bundle -v
Bundler version 1.9.2
total allocations
{:T_NONE=>0}
{:T_UNDEF=>0}
{:T_FIXNUM=>0}
{:T_SYMBOL=>0}
{:T_FALSE=>0}
{:T_TRUE=>0}
{:T_NIL=>0}
{:unknown=>0}
{:T_COMPLEX=>0}
{:T_BIGNUM=>0}
{:T_ZOMBIE=>0}
{:T_RATIONAL=>1}
{:T_FLOAT=>2}
{:T_MODULE=>47}
{:T_ICLASS=>62}
{:T_MATCH=>111}
{:T_HASH=>356}
{:T_CLASS=>357}
{:T_DATA=>3829}
{:T_NODE=>66860}
{:T_STRUCT=>100049}
{:T_FILE=>100100}
{:T_REGEXP=>100309}
{:T_IMEMO=>102179}
{:T_OBJECT=>200169}
{:T_ARRAY=>311297}
{:T_STRING=>2253401}
[aaron@TC rubygems (master)]$ time GEM_HOME=100k_gems GEM_PATH=100k_gems ruby -I lib:. 100k_gems/bin/bundle -v
Bundler version 1.9.2
real 0m22.886s
user 0m12.165s
sys 0m3.567s
[aaron@TC rubygems (master)]$
[aaron@TC rubygems (specs)]$ GEM_HOME=100k_gems GEM_PATH=100k_gems ruby -I lib:~/git/allocation_tracer/lib:. -rmem_usage 100k_gems/bin/bundle -v
Bundler version 1.9.2
total allocations
{:T_NONE=>0}
{:T_UNDEF=>0}
{:T_FIXNUM=>0}
{:T_SYMBOL=>0}
{:T_FALSE=>0}
{:T_TRUE=>0}
{:T_NIL=>0}
{:unknown=>0}
{:T_COMPLEX=>0}
{:T_BIGNUM=>0}
{:T_ZOMBIE=>0}
{:T_RATIONAL=>1}
{:T_FLOAT=>2}
{:T_STRUCT=>41}
{:T_MODULE=>47}
{:T_ICLASS=>62}
{:T_MATCH=>88}
{:T_FILE=>90}
{:T_OBJECT=>150}
{:T_REGEXP=>301}
{:T_CLASS=>357}
{:T_HASH=>358}
{:T_IMEMO=>2162}
{:T_DATA=>3829}
{:T_ARRAY=>11259}
{:T_STRING=>53135}
{:T_NODE=>66855}
[aaron@TC rubygems (specs)]$ time GEM_HOME=100k_gems GEM_PATH=100k_gems ruby -I lib:. 100k_gems/bin/bundle -v
Bundler version 1.9.2
real 0m0.573s
user 0m0.459s
sys 0m0.108s
[aaron@TC rubygems (specs)]$
require 'allocation_tracer'
ObjectSpace::AllocationTracer.start
at_exit {
puts "total allocations"
ObjectSpace::AllocationTracer.stop
ObjectSpace::AllocationTracer.allocated_count_table.sort_by(&:last).each do |k,v|
p k => v
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.