Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Can we improve upon the sass compiler performance? #313
First off, thanks a lot for django-pipeline because I cannot imagine developing with django without it.
Here's the situation:
You might think 1.5 seconds is not a lot but this is a trivial setup at the moment with nothing but bootstrap 3.1 being pulled in but I don't think it will gain much more time. Even with a nearly empty scss file and no bootstrap it takes 1.3 seconds to load a page.
Just simply clicking around my app going page to page feels really slow and it's slowly killing me inside.
With debug false and after running collectstatic then things are fast like usual because the sass files have been pre-compiled to css (right?), so there's no problem here.
With rails on the same machine using sass and coffee script the same requests happen in 100ms or so in development mode and it's handling the scss/coffeescript conversion to css/js behind the scenes in between page views. It feels very seamless to develop against.
Are there any strategies we can implement to improve the sass compiling time in development mode? Technically it appears possible because it's not delayed in rails at all.
+1 and ideas:
@cyberdelia Tried running that. I see no performance benefit whatsoever from the 1.4.x branch. It's still forking tons of sass processes, four at a time, for each .scss file on every page load. On my main development box with RVM and lots of other Ruby stuff installed, sass takes a little longer to start each time. I also have a VM with a more plain Ruby installation that can start sass quicker, but this is less than ideal. I just dropped some other old Python packages with bizarre, obsolete dependencies, and am trying to get rid of the VM in favor of developing this app locally again, but I'm still seeing 10-20s page loads with django-pipeline.
Joining the conversation pretty late here but wanted to check in and see what you all have been doing for this.
@AntelopeSalad have you come up with your own solution or are you still dealing with super long requests in your dev environment?
I like @charredUtensil's idea number 2 regarding taking advantage of Sass's
@cyberdelia Couldn't this be as simple as an optional setting that tells
Pretty simple/harmless, and it's allowing me to use sass with pipeline in my dev environment with 10x faster requests. In my dev settings only, I add
And if I'm not working with CSS at the moment, I don't even have to worry about running that command. After all, why do I need pipeline to recompile my Sass files on every request if I'm not working on CSS?
Unless you know of a better solution, I will definitely be using this going forward!
added a commit
Mar 15, 2015
referenced this issue
Mar 15, 2015
I had the same problem till a colleague told me about sassc and libsass. This sass compiler is made in C which makes it ten times faster. I followed these instructions to install it on my Mac (brew has some older versions) https://www.snip2code.com/Snippet/189303/Install-SassC---LibSass-for-Mac-OS-X-10- .
# Install SassC Interpreter $ cd /usr/local/src $ curl -kL https://github.com/hcatlin/libsass/archive/master.zip > libsass.zip $ unzip libsass.zip # Install LibSass Library $ cd /usr/local/src $ curl -kL https://github.com/sass/sassc/archive/master.zip > sassc.zip $ unzip sassc.zip # Compile SassC $ export SASS_LIBSASS_PATH="/usr/local/src/libsass-master" $ cd sassc-master $ make $ sudo ln -s $(pwd)/bin/sassc /usr/local/bin/sassc $ chmod +x /usr/local/bin/sassc # Example Usage $ /usr/local/bin/sassc ~/Desktop/input.scss ~/Desktop/output.css
Next, you just add these settings and it works a lot faster
PIPELINE_COMPILERS = ( 'pipeline.compilers.sass.SASSCompiler', ) PIPELINE_SASS_BINARY = '/usr/bin/env sassc'