Skip to content

Instantly share code, notes, and snippets.

@SamSaffron
Last active May 24, 2016 00:09
Show Gist options
  • Save SamSaffron/4f6fec9be5d1e94d13458b494db08f69 to your computer and use it in GitHub Desktop.
Save SamSaffron/4f6fec9be5d1e94d13458b494db08f69 to your computer and use it in GitHub Desktop.

MiniRacer https://github.com/discourse/mini_racer is ready for testing.

Can you help out measuring how it improves performance for rake assets:precompile in your app?

  • Run:
rm -fr public/assets
RAILS_ENV=production time bundle exec rake assets:precompile
  • Edit Gemfile. Remove therubyracer, add:
gem 'execjs', github: 'rails/execjs'
gem 'mini_racer'
  • bundle install

  • Run:

rm -fr public/assets
RAILS_ENV=production time bundle exec rake assets:precompile
@JuanitoFatas
Copy link

System nodejs

2.65s user 0.84s system 101% cpu 3.436 total

mini_racer

2.61s user 0.82s system 101% cpu 3.380 total

@heliocola
Copy link

heliocola commented May 17, 2016

therubyracer:

61.20 real        54.50 user         2.17 sys

mini_racer: 6x faster! :-)

10.30 real         5.26 user         1.50 sys

@jimmynguyc
Copy link

ruby 2.0.0p481 on OSX 10.11.4

nodejs
9.37s user 1.59s system 99% cpu 11.065 total
9.58s user 1.62s system 99% cpu 11.310 total
9.49s user 1.60s system 99% cpu 11.199 total

mini_racer
9.21s user 1.59s system 99% cpu 10.894 total
9.26s user 1.60s system 99% cpu 10.920 total
9.07s user 1.57s system 99% cpu 10.691 total

@joerichsen
Copy link

Before (therubyracer)

265.78s user 14.32s system 96% cpu 4:50.77 total

After (mini_racer)

263.41s user 13.61s system 97% cpu 4:43.23 total

@jdowning
Copy link

Rails 4.1.15

using nodejs 4.0.0
76.85s user 19.09s system 86% cpu 1:51.19 total

using mini_racer
14.65s user 6.44s system 68% cpu 30.843 total

🎉

@ibrahima
Copy link

Are you guys deleting the sprockets cache (tmp/assets) between runs? I got several times speed up at first too but then after doing that the speed up was reduced to 25% (still good, but not as unbelievable as I first thought).

@clupprich
Copy link

Before (therubracer)
21.35s user 6.19s system 96% cpu 28.639 total

After (mini_racer)
4.67s user 1.82s system 84% cpu 7.663 total

@jmbejar
Copy link

jmbejar commented May 17, 2016

Running in a small Rails 5 application (ruby 2.3.1p112) the command:
time RAILS_ENV=production bundle exec rake assets:precompile
(after running rm -rf public/assets tmp/cache/assets)

therubyracer
30.90s user 0.91s system 100% cpu 31.744 total

system node (v4.4.4)
13.35s user 0.99s system 103% cpu 13.913 total

mini_racer
12.33s user 1.02s system 103% cpu 12.858 total

@nickbrowne
Copy link

Are you guys deleting the sprockets cache (tmp/assets) between runs? I got several times speed up at first too but then after doing that the speed up was reduced to 25% (still good, but not as unbelievable as I first thought).

I've been using assets:clobber

@JanDintel
Copy link

Results after running rm -rf public/assets tmp/cache/assets before runs:

therubyracer:
67.42s user 3.39s system 95% cpu 1:14.36 total

mini_racer:
55.45s user 3.28s system 97% cpu 59.960 total

@rbishop
Copy link

rbishop commented May 24, 2016

Cleared caches and made sure spring wasn't running. Results:

therubyracer: 3m50s user
mini_racer: 1m48s user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment