Skip to content

Instantly share code, notes, and snippets.

@jrafanie
Last active June 2, 2016 15:35
Show Gist options
  • Save jrafanie/607ef1d44197a17c275e9d8f4d251dc2 to your computer and use it in GitHub Desktop.
Save jrafanie/607ef1d44197a17c275e9d8f4d251dc2 to your computer and use it in GitHub Desktop.
Lazy evaluating asset timestamps on sprockets on 3.6.0 https://github.com/rails/sprockets/pull/211
# Using sprockets 3.6.0 with spocket-rails 3.0.4
# 171 - 177 MB of memory used booting rails before
11:24:33 ~/Code/manageiq (master) (2.2.5) + RAILS_ENV=production bin/rails r 'top = `/usr/bin/top -l 1 -pid #{Process.pid} | grep -E "ruby.+M"`; memory = top.split[7].to_i; puts memory'
177
11:24:43 ~/Code/manageiq (master) (2.2.5) + RAILS_ENV=production bin/rails r 'top = `/usr/bin/top -l 1 -pid #{Process.pid} | grep -E "ruby.+M"`; memory = top.split[7].to_i; puts memory'
171
11:25:31 ~/Code/manageiq (master) (2.2.5) + RAILS_ENV=production bin/rails r 'top = `/usr/bin/top -l 1 -pid #{Process.pid} | grep -E "ruby.+M"`; memory = top.split[7].to_i; puts memory'
177
# 8.3 seconds booting rails before
11:25:51 ~/Code/manageiq (master) (2.2.5) + time RAILS_ENV=production bin/rails r 1
RAILS_ENV=production bin/rails r 1 6.81s user 1.41s system 99% cpu 8.256 total
11:26:15 ~/Code/manageiq (master) (2.2.5) + time RAILS_ENV=production bin/rails r 1
RAILS_ENV=production bin/rails r 1 6.88s user 1.40s system 99% cpu 8.320 total
11:26:25 ~/Code/manageiq (master) (2.2.5) + time RAILS_ENV=production bin/rails r 1
RAILS_ENV=production bin/rails r 1 6.85s user 1.43s system 99% cpu 8.319 total
# Now, patch sprockets 3.6.0
11:26:39 ~/Code/manageiq (master) (2.2.5) + bundle show sprockets
/Users/joerafaniello/.gem/ruby/2.2.5/gems/sprockets-3.6.0
11:26:52 ~/Code/manageiq (master) (2.2.5) + pushd /Users/joerafaniello/.gem/ruby/2.2.5/gems/sprockets-3.6.0
11:27:01 ~GEM_HOME/gems/sprockets-3.6.0 (2.2.5) + wget https://github.com/rails/sprockets/commit/d0698b3c338ab3372d00e5b8d0cb5f496742e1f7.patch
--2016-06-02 11:27:02-- https://github.com/rails/sprockets/commit/d0698b3c338ab3372d00e5b8d0cb5f496742e1f7.patch
Resolving github.com... 192.30.252.130
Connecting to github.com|192.30.252.130|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: 'd0698b3c338ab3372d00e5b8d0cb5f496742e1f7.patch'
d0698b3c338ab3372d00e5b8d0cb5f496742e1f7.patch [ <=> ] 1.74K --.-KB/s in 0.002s
2016-06-02 11:27:02 (1.13 MB/s) - 'd0698b3c338ab3372d00e5b8d0cb5f496742e1f7.patch' saved [1780]
11:27:17 ~GEM_HOME/gems/sprockets-3.6.0 (2.2.5) + patch -p1 < d0698b3c338ab3372d00e5b8d0cb5f496742e1f7.patch
patching file lib/sprockets/cache/file_store.rb
11:27:22 ~GEM_HOME/gems/sprockets-3.6.0 (2.2.5) + popd
# 163-165 MB of memory used booting rails After( ~10 MB saved )
11:27:28 ~/Code/manageiq (master) (2.2.5) + RAILS_ENV=production bin/rails r 'top = `/usr/bin/top -l 1 -pid #{Process.pid} | grep -E "ruby.+M"`; memory = top.split[7].to_i; puts memory'
163
11:27:37 ~/Code/manageiq (master) (2.2.5) + RAILS_ENV=production bin/rails r 'top = `/usr/bin/top -l 1 -pid #{Process.pid} | grep -E "ruby.+M"`; memory = top.split[7].to_i; puts memory'
165
11:27:47 ~/Code/manageiq (master) (2.2.5) + RAILS_ENV=production bin/rails r 'top = `/usr/bin/top -l 1 -pid #{Process.pid} | grep -E "ruby.+M"`; memory = top.split[7].to_i; puts memory'
163
# 8 seconds booting rails after (~0.3 seconds saved)
11:28:00 ~/Code/manageiq (master) (2.2.5) + time RAILS_ENV=production bin/rails r 1
RAILS_ENV=production bin/rails r 1 6.66s user 1.29s system 99% cpu 7.984 total
11:28:10 ~/Code/manageiq (master) (2.2.5) + time RAILS_ENV=production bin/rails r 1
RAILS_ENV=production bin/rails r 1 6.75s user 1.29s system 99% cpu 8.073 total
11:28:29 ~/Code/manageiq (master) (2.2.5) + time RAILS_ENV=production bin/rails r 1
RAILS_ENV=production bin/rails r 1 6.73s user 1.29s system 99% cpu 8.053 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment