Skip to content

Commit

Permalink
add object stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie Somerville committed Jun 5, 2013
1 parent e10cc44 commit 0d57fcc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,19 @@ Rake::TestTask.new do |t|
t.pattern = "test/test_*.rb"
end

task :objects do
GC.start
before = ObjectSpace.count_objects
$:.unshift File.expand_path("../lib", __FILE__)
require "mime/types"
GC.start
after = ObjectSpace.count_objects
for key, delta in before.keys
.grep(/T_/)
.map { |key| [key, after[key] - before[key]] }
.sort_by { |key, delta| -delta }
printf "%10s +%6d\n", key, delta
end
end

task :default => :test

0 comments on commit 0d57fcc

Please sign in to comment.