medindo performance do seu código ruby, com rafael frança
TRANSCRIPT
time rspec
Finished in 9.88 seconds (files took 15.64 seconds to load)
real 0m25.520suser 0m0.371ssys 0m0.135s
time rspec
Finished in 9.88 seconds (files took 8.64 seconds to load)
real 0m18.520suser 0m0.371ssys 0m0.135s
• Ruby 1.8: simple mark and sweep
• Ruby 1.9.3: lazy sweep
• Ruby 2.0: bitmaps for COW-safety
• Ruby 2.1: oldgen and minor marking
• Ruby 2.2: Incremental GC
http://tmm1.net/ruby21-rgengc/https://engineering.heroku.com/blogs/2015-02-04-incremental-gc
require File.expand_path('../config/environment', __FILE__)p GC.stat # => {:count=>72,# :heap_used=>734,# :heap_length=>1319,# :heap_increment=>585,# :heap_live_num=>290292,# :heap_free_num=>62404,# :heap_final_num=>0,# :total_allocated_object=>1955696,# :total_freed_object=>1665404}
rake -f perf.rake perf:require_bench
action_controller/railtie: 1.06 mb action_controller: 0.72 mb action_controller/metal/live: 0.38 mb action_dispatch/http/response: 0.17 mb rack/request: 0.05 mb
$ rake -f perf.rake perf:memallocated objects by gem----------------------------------- 4283 activesupport-4.0.13 2729 actionpack-4.0.13 1231 sprockets-2.11.0 944 newrelic_rpm-3.7.2.195 438 hike-1.2.3 340 rack-1.5.2 268 2.1.5/lib
Indo além
• memory_profilerhttps://github.com/SamSaffron/memory_profiler
• allocation_tracerhttps://github.com/ko1/allocation_tracer
• stackprofhttps://github.com/tmm1/stackprof