GithubHelp home page GithubHelp logo

Does it work at all? about sassc-rails HOT 12 CLOSED

sass avatar sass commented on August 19, 2024
Does it work at all?

from sassc-rails.

Comments (12)

bolandrm avatar bolandrm commented on August 19, 2024

I see you've got sass-rails installed. That's probably conflicting.

See here: #6 (comment)

from sassc-rails.

varyform avatar varyform commented on August 19, 2024

@bolandrm no, I don't, check the diff

from sassc-rails.

bolandrm avatar bolandrm commented on August 19, 2024

Ah, ok. After you check out the other branch, did you bundle and spring stop ?

from sassc-rails.

varyform avatar varyform commented on August 19, 2024

I don't use spring and yeah, I did bundle :)

from sassc-rails.

bolandrm avatar bolandrm commented on August 19, 2024

interesting... perhaps you need to run bundle exec rake assets:precompile? not sure.

Failing that, can you run bundle open sassc-rails and add some puts statements to see if the SassC::Rails template is being used?

    # lib/sassc/rails/template.rb

    module Sprockets3
      def call(input)
        context = input[:environment].context_class.new(input)

        puts "using sassc rails"         # <-------------

or if using sprockets 2

   # lib/sassc/rails/template.rb

    module Sprockets2
     # ..

      def evaluate(context, locals, &block)
        puts "using sassc rails"          # <-------------

see if that prints anything out during assets precompile...

from sassc-rails.

varyform avatar varyform commented on August 19, 2024

Yeah, I tried that too y-day, and it's definitely using sassc-rails b/c compilation time is ~15-20% slower vs ruby sass.

oleh@varyform-mbp:~/projects/project (experiments/sassc)$ rm -rf tmp/cache/assets public/assets && time bundle exec rake assets:precompile 2>/dev/null
using sassc rails
using sassc rails
using sassc rails
using sassc rails
using sassc rails
using sassc rails
using sassc rails
using sassc rails
using sassc rails
using sassc rails
using sassc rails
using sassc rails

real  0m49.870s
user  0m40.718s
sys 0m9.516s
oleh@varyform-mbp:~/projects/project (experiments/sassc)$ git checkout master
Switched to branch 'master'
oleh@varyform-mbp:~/projects/project (master)$ rm -rf tmp/cache/assets public/assets && time bundle exec rake assets:precompile 2>/dev/null

real  0m43.718s
user  0m38.205s
sys 0m5.963s

from sassc-rails.

bolandrm avatar bolandrm commented on August 19, 2024

I'm not sure what's going on then. Here are my results:

# With sassc-rails:
bundle exec rake assets:precompile 2> /dev/null  29.52s user 6.44s system 99% cpu 36.180 total
# with normal sass-rails:
bundle exec rake assets:precompile 2> /dev/null  33.41s user 6.51s system 97% cpu 40.826 total

assets:precompile is noisy though, because it's compiling a bunch of stuff that isn't css. Could you try the benchmark that i have in the readme? (in rails console)

from sassc-rails.

varyform avatar varyform commented on August 19, 2024

When I try one file it's 4.53s with sassc vs 6.16 with ruby sass.
Not even close to 4x, but still an improvement :)
The reason complete suit takes longer may be related to cache.
I have 2 big CSS files in my app, both have ±15 imports, but some of those imports match.
So ruby sass probably reuses compiled files for 2nd import.

Here in 2nd pass I don't remove tmp/cache/assets and the difference is visible.

oleh@imac:~/projects/project (master)$ rm -rf tmp/cache/assets public/assets && time bundle exec rake assets:precompile 2>/dev/null

real  0m44.866s
user  0m37.571s
sys 0m6.530s
oleh@imac:~/projects/project (master)$ rm -rf public/assets && time bundle exec rake assets:precompile 2>/dev/null

real  0m11.291s
user  0m9.291s
sys 0m1.805s

from sassc-rails.

bolandrm avatar bolandrm commented on August 19, 2024

Are you using sass import statement, or sprockets require?

I could be wrong, but I don't believe that ruby sass can cache imported files. Just because you could have set different variables before importing the file, which would affect the compilation of the file.

On the other hand, sprockets require can be cached.

from sassc-rails.

varyform avatar varyform commented on August 19, 2024

Imports only.

And my last comparison was not correct, b/c I have a lot of JS files (which are cached by sprockets) and some standalone sass files (specified in config/initializers/assets.rb)

When I only keep those 2 big files in assets.rb and remove sprockets cache – there is no difference at all with ruby sass.

And the same flow on sassc branch gives me 7s vs 22s.

Will probably try to do some more benchmarks to figure out what exactly makes whole suit to take more time in my case.

The issue can be closed, sorry for wasting your time :)

from sassc-rails.

bolandrm avatar bolandrm commented on August 19, 2024

No problem. Let me know if you find any interesting results. Thanks!

from sassc-rails.

varyform avatar varyform commented on August 19, 2024

The problem was in sprockets: master branch was using 2.12.4, while sassc 3.3.5.
Updating sprockets on master to same 3.3.5 gave the following results:

  • master before sprockets update: 41s
  • master after sprockets update: 59s
  • sassc: 49s

from sassc-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.