Skip to content
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

135M mini_racer-0.6.2 #235

Open
chrishough opened this issue Feb 3, 2022 · 11 comments
Open

135M mini_racer-0.6.2 #235

chrishough opened this issue Feb 3, 2022 · 11 comments

Comments

@chrishough
Copy link

Why is this gem so large? It has started to cause my heroku slug deploys to break because it is pushing me over the limit. Is there. away to reduce this?

@SamSaffron
Copy link
Collaborator

SamSaffron commented Feb 3, 2022

libv8.a is quite bit ~30 megs I think and it is included twice due to Ruby gems shenanigans we can probably remove one copy ... but get this much smaller than that... no ... it is basically the size of google chrome.

will investigate ...

@chrishough
Copy link
Author

If we can remove it once, that would be awesome, so there is only one copy of it 👍

@SamSaffron
Copy link
Collaborator

note libv8_monolith.a is 117. MiB so there is that as well.

Long term plan is for everything to be self contained.

@chrishough
Copy link
Author

Right now I am using this to purge what I can from the advice of the team at DataDog, and a lot of reading online...

namespace :heroku do
  desc "Cleans up unnecessary cached files from gems installed via bundler"
  task clean_gem_artifacts: :environment do
    puts "\n*************************************\n"
    puts "Cleaning up SASSC Artifacts"
    Bundler.bundle_path.glob( "**/ext/**/*.o" ).each( &:delete )
    puts "Cleaning up Gem Artifacts"
    # rubocop:disable Layout/SpaceInsideParens
    system(`find $(bundle show libv8-node) \\( -name '*.a' \\) -exec rm {} \\;`)
    # rubocop:enable Layout/SpaceInsideParens
    puts "\n*************************************\n"
  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

@nightpool
Copy link
Contributor

nightpool commented Feb 4, 2022

find $(bundle show libv8-node) \( -name '*.a' \) -exec rm {} \;

Wouldn't this just delete V8 entirely, making MiniRacer completely inoperable? Why not just remove the gem in that case?

@chrishough
Copy link
Author

@nightpool according to the DataDog team, those are not required, also our tests showed that was the case.

@SamSaffron
Copy link
Collaborator

SamSaffron commented Feb 4, 2022 via email

@chrishough
Copy link
Author

Screen Shot 2022-02-04 at 12 25 55 PM

@bisrael
Copy link

bisrael commented Jul 27, 2022

Not sure if it helps, but in our production install of 0.6.2, seeing 2 copies of mini_racer_extension.so as reported by du

remote: MINIRACER:
remote: 68M /tmp/build_137e1580/vendor/bundle/ruby/2.7.0/gems/mini_racer-0.6.2/lib/mini_racer_extension.so
remote: 68M /tmp/build_137e1580/vendor/bundle/ruby/2.7.0/gems/mini_racer-0.6.2/lib
remote: 68M /tmp/build_137e1580/vendor/bundle/ruby/2.7.0/gems/mini_racer-0.6.2/ext/mini_racer_extension/mini_racer_extension.so
remote: 69M /tmp/build_137e1580/vendor/bundle/ruby/2.7.0/gems/mini_racer-0.6.2/ext/mini_racer_extension
remote: 69M /tmp/build_137e1580/vendor/bundle/ruby/2.7.0/gems/mini_racer-0.6.2/ext
remote: 136M /tmp/build_137e1580/vendor/bundle/ruby/2.7.0/gems/mini_racer-0.6.2

dunno if that's a symlink or something?

@tisba
Copy link
Collaborator

tisba commented May 27, 2023

@bisrael: I cannot reproduce this (neither with 0.6.2 nor with 0.6.4):

$ gem install mini_racer -v 0.6.4
# …
8.0K    ./bin
 80K    ./ext/mini_racer_extension
 20K    ./ext/mini_racer_loader
100K    ./ext
4.0K    ./.github/workflows
4.0K    ./.github
 16K    ./lib/mini_racer
 59M    ./lib
 59M    .

@tisba
Copy link
Collaborator

tisba commented May 27, 2023

Removing the libv8_monolith.a from lib8-node gem will work. Until you try to update mini_racer and hence have to compile the new version against libv8-node. The only use case I can currently think of is when building Dockage container images.

I'm a little hesitant adding a hint to the README, because there are already quite a few issues from users with installation problems and I don't like to add potential for more cases…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants