IssueRaiser

sassc is very slow to compile and install

When doing a `bundle install` for a new Rails 6 app, I noticed most of the time is spent compiling `sassc` (libsass really). This takes easily up to 2 minutes on Linux, which feels really slow for one gem. A bit of a Nokogiri-like experience if you see what I mean. Speaking of Nokogiri, they now have a prerelease gem installing in just 1 second, maybe we can use a similar approach? ``` $ ruby -v ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux] $ time gem install sassc Building native extensions. This could take a while... Successfully installed sassc-2.2.1 1 gem installed 89.75s user 5.43s system 99% cpu 1:36.12 total ``` I'm not sure what's the best way to address this but here are some ideas: * Use the Makefile of libsass to build libsass as a shared library, and just link the C extension to it (as it used to be). * Use make parallelism automatically, e.g., by setting MAKEFLAGS * Distribute a binary gem on Linux and macOS. This requires having an easy workaround for non-glibc (e.g., alpine) to install from source, or not depending on on glibc (by linking the libc statically?). * Changes in libsass so it compiles faster, such as #132. * I thought the `-flto` might slow things down but actually it seems to speed up compilation with `g++ 8.3.1`! `time gem install sassc -- --disable-lto` takes `113.71s user 6.01s system 99% cpu 2:00.70 total`. Disabling all flags gives: `time gem install sassc -- --disable-lto --disable-march-tune-native --disable-s

Posted by eregon on Mar 8, 2020, 1:24 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

reliability (SaaS)

sassc is very slow to compile and install

eregonMar 8, 2020, 1:24 PM

When doing a `bundle install` for a new Rails 6 app, I noticed most of the time is spent compiling `sassc` (libsass really). This takes easily up to 2 minutes on Linux, which feels really slow for one gem. A bit of a Nokogiri-like experience if you see what I mean. Speaking of Nokogiri, they now have a prerelease gem installing in just 1 second, maybe we can use a similar approach? ``` $ ruby -v ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux] $ time gem install sassc Building native extensions. This could take a while... Successfully installed sassc-2.2.1 1 gem installed 89.75s user 5.43s system 99% cpu 1:36.12 total ``` I'm not sure what's the best way to address this but here are some ideas: * Use the Makefile of libsass to build libsass as a shared library, and just link the C extension to it (as it used to be). * Use make parallelism automatically, e.g., by setting MAKEFLAGS * Distribute a binary gem on Linux and macOS. This requires having an easy workaround for non-glibc (e.g., alpine) to install from source, or not depending on on glibc (by linking the libc statically?). * Changes in libsass so it compiles faster, such as #132. * I thought the `-flto` might slow things down but actually it seems to speed up compilation with `g++ 8.3.1`! `time gem install sassc -- --disable-lto` takes `113.71s user 6.01s system 99% cpu 2:00.70 total`. Disabling all flags gives: `time gem install sassc -- --disable-lto --disable-march-tune-native --disable-s

Comments (0)

No comments yet. Start the discussion.

Comment on this issue