-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiled extension has exploded in size in recent versions #200
Comments
I think the relevant change was 82caf8e |
I think what happened is that the commit I mentioned above made sassc-ruby use |
I should note that I have not consciously set |
I also noticed this recently. The
This is a problem for us on Heroku, where "slug" size is important. |
This is a real problem on the slug size. Any chance it will be fixed? |
This seems to be related to a bunch of |
@xinwelcome @jaredbeck I have ended up with the following workaround: # lib/tasks/heroku.rake
# This file was heavily influenced by https://blog.saeloun.com/2020/05/04/how-to-reduce-heroku-slug-size.html
namespace :heroku do
desc 'Removes extra .o files from native extension builds'
task :clean_gem_artifacts do
Bundler.bundle_path.
glob('**/ext/**/*.o').
each(&:delete)
end
end
if Rake::Task.task_defined?('assets:clean')
Rake::Task['assets:clean'].enhance ['heroku:clean_gem_artifacts']
else
Rake::Task.define_task('assets:clean' => 'heroku:clean_gem_artifacts')
end |
This is also contributing to a problem in distributed CI workflows, where disk workspaces need to be decompressed on fairly small containers - the total size of our installed gems directory (the bulk of that workspace) is up to 660MB, and this is one of the largest contributors to that. I'm not following the MakeMakefile logic, but it should be straightforward to clean up the .o files after building the .so files, right? It looks like there's some provision for it under |
Hello, The workaround didn't make the job for me, it doesn't run during the build. Even deleting everything manually didn't work to reduce de slug size during build. Any chance you'll put the lib on a diet soon? It's a very big problem, it causes at least 30% of the slug size and Heroku is very strict with those 500M max. |
@anthonyamar I've noted a typo in the snippet I posted before and updated it.Perhaps this helps? |
@timon Thanks! Yes, what's the typo? How do you launch the script before Heroku slug compression? |
@anthonyamar Click on the word "edited" on the post, and you'll see a list of revisions. Then click on the last revision. |
@timon that hack worked for me, but from what I can tell only shaved off about 20ish MB |
For old versions of ruby without access to Pathname#glob, you can use instead:
|
For stack heroku-20, ruby 2.7.8, ended up using .slugignore:
|
It seems the compiled extension has become a lot bigger recently. This is becoming a problem on my VPS. Here's the size on my development machine for some recent versions:
What could be going on and how can I reduce this size?
The text was updated successfully, but these errors were encountered: