TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Bootsnap: Optimizing Ruby App Boot Time

285 pointsby Finbarralmost 8 years ago

11 comments

JohnBootyalmost 8 years ago
Wow! This is potentially a real gain for us. We have a big in-house, monolithic Rails app.<p>My initial experiment was encouraging. Boot time in development mode went from ~23sec to ~16sec, and I only enabled it for the main engine that comprises about 85% of our codebase so the real gains might be larger.<p>Looking forward to seeing what it can do in production mode - our boot times there are horrendous and it&#x27;s a big deal for things like cron jobs. Thank you to all those who worked on this.
chrisseatonalmost 8 years ago
In the implementation of Ruby that I work on, TruffleRuby, we&#x27;ve been exploring lazy parsing, where the parser will find a method but not fully parse it until the method is called for the first time. I wonder if there&#x27;s any other modifications you could make to the VM itself to improve startup time.
评论 #14378074 未加载
评论 #14381573 未加载
评论 #14378043 未加载
burkealmost 8 years ago
I&#x27;m the primary author, can answer questions if you have any.
评论 #14377991 未加载
评论 #14379236 未加载
评论 #14378161 未加载
评论 #14379339 未加载
评论 #14379237 未加载
dobsalmost 8 years ago
Gave this a quick shot on my own monolithic app and it cut startup time almost in half. Impressive considering how easy it was to configure!<p>Startup time was one reason we started migrating away from Rails in a previous workplace, between frustrating startup time in development and test and occasional quirkiness of zeus and spring. Bootsnap would have been a godsend.
评论 #14378207 未加载
jitlalmost 8 years ago
This is awesome, and I&#x27;d love to use it for the command-line dev tools that I write. Unfortunately this gem requires Ruby 2.3+, but macOS built-in Ruby, which is the Ruby we target, is only 2.0.0.<p>Does anyone know of a good solution for prebuilt, relocatable Rubies on macOS that I could easily bundle with my tool? I&#x27;m reluctant to use Homebrew or another package manager like rbenv, where I&#x27;d have to implement a non-trivial bootstrap process. Phusion&#x27;s travelling-ruby project would be perfect, but it&#x27;s unmaintained.<p>I just want my CLI to boot in 0.05s without needing to change languages. Love Ruby, but getting decent perf takes a bit of effort.
评论 #14378368 未加载
评论 #14381330 未加载
评论 #14378184 未加载
dismantlethesunalmost 8 years ago
I&#x27;m kinda shocked that Ruby boot times can be up to 25 seconds for a monolithic app.<p>A Python project I work on has 279,124 lines of code and boots up in 2.5 seconds.<p>Without downloading it, all I can find is Discourse had 60,000 lines of code 3 years ago [1]. Assuming as an extreme estimate they tripled their code size in 3 years, we have 180,000 LOC taking 6 seconds to boot up according to the article.<p>Is this normal for Ruby? Is the author using a spinning disk drive rather than an SSD?<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;bleonard&#x2F;rails_stats" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bleonard&#x2F;rails_stats</a>
评论 #14378264 未加载
评论 #14379450 未加载
评论 #14378208 未加载
评论 #14378213 未加载
评论 #14379565 未加载
评论 #14378238 未加载
评论 #14379949 未加载
Ceriumalmost 8 years ago
Thanks for releasing this, I gave it a try.<p>Starting benchmark time: 13.05 seconds. With load_path_cache: 10.01 seconds<p>Sadly, with compile_cache on I&#x27;m getting an error. &#x2F;vendor&#x2F;bundle&#x2F;ruby&#x2F;2.3.0&#x2F;gems&#x2F;bootsnap-0.2.14&#x2F;lib&#x2F;bootsnap&#x2F;compile_cache&#x2F;iseq.rb:30:in `fetch&#x27;: No space left on device (Errno::ENOSPC)<p>Any ideas on what causes this?
评论 #14379440 未加载
ausjkealmost 8 years ago
Considering PHP7, Java8&#x2F;Kotlin, Go, C++17, Python3, Javascript&#x2F;ES6 etc these days, how will Rudy be doing in the long run? any reason for new comers to pick up Ruby instead of the mentioned list? I just started using PHP myself.
评论 #14379791 未加载
评论 #14391019 未加载
评论 #14379683 未加载
评论 #14379233 未加载
评论 #14380382 未加载
评论 #14379411 未加载
omarforgotpwdalmost 8 years ago
Might have missed something, but why not just merge these changes into Rails?
评论 #14381131 未加载
misterbowfingeralmost 8 years ago
Are there plans to support JRuby?
评论 #14378901 未加载
iagooaralmost 8 years ago
-
评论 #14378102 未加载
评论 #14378194 未加载