Skip to content

Instantly share code, notes, and snippets.

@SamSaffron
Last active December 29, 2015 12:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save SamSaffron/7668043 to your computer and use it in GitHub Desktop.
Results for tmm1 patch
start = Time.now
require 'objspace'
require File.expand_path("../../config/environment", __FILE__)
# preload stuff
I18n.t(:posts)
# load up all models and schema
(ActiveRecord::Base.connection.tables - %w[schema_migrations]).each do |table|
table.classify.constantize.first rescue nil
end
# router warm up
Rails.application.routes.recognize_path('abc') rescue nil
puts "Ruby version #{RUBY_VERSION} p#{RUBY_PATCHLEVEL}"
puts "Bootup time: #{Time.now - start} secs"
GC.start
puts "RSS: #{`ps -o rss -p #{$$}`.chomp.split("\n").last.to_i} KB"
s = ObjectSpace.each_object(String).map do |o|
ObjectSpace.memsize_of(o) + 40 # rvalue size on x64
end
puts "Total strings: #{s.count} space used: #{s.sum} bytes"
sam@ubuntu:~/Source/discourse$ RAILS_ENV=production ruby script/test_mem.rb
Ruby version 2.0.0 p247
Bootup time: 5.392332971 secs
RSS: 144032 KB
Total strings: 218850 space used: 15311179 bytes
# WITHOUT tmm1 patch
sam@ubuntu:~/Source/discourse$ RAILS_ENV=production ruby script/test_mem.rb
Ruby version 2.1.0 p-1
Bootup time: 3.390009645 secs
RSS: 162428 KB
Total strings: 205098 space used: 17528176 bytes
sam@ubuntu:~/Source/discourse$
# WITH tmm1 patch
sam@ubuntu:~/Source/discourse$ RAILS_ENV=production ruby script/test_mem.rb
Ruby version 2.1.0 p-1
Bootup time: 3.392915642 secs
RSS: 155648 KB
Total strings: 151501 space used: 14867281 bytes
sam@ubuntu:~/Source/discourse$
# CURRENT HEAD
sam@ubuntu:~/Source/discourse$ RAILS_ENV=production ruby script/test_mem.rb
Ruby version 2.1.0 p-1
Bootup time: 3.36488041 secs
RSS: 156984 KB
Total strings: 146455 space used: 14586632 bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment