ember-cli-sass icon indicating copy to clipboard operation
ember-cli-sass copied to clipboard

performance

Open stefanpenner opened this issue 9 years ago • 12 comments

There is an easy way to get much better performance. Currently, everything in bower_components/vendor and app are considered when determining if a rebuild is needed or not.

Now this means stuff "magically" works, but this means as an app and vendor grow. Copious time is spent merely figuring out if some input file changed or not.

We have several options, likely worth exploring. Most affective would be:

  1. only watch app/styles by default
  2. give users an API to add additional "input paths"

An example API could be:

var app = new EmberApp();

app.cssPaths.concat([
  app.name + '/styles/**/*.scss',
  'bower_components/material-design-lite-src/src/**/*.scss'
]);

Another thing, would be to add matcher, to only both detecting specific file types. This will require some fixes to our change detection, but again may yield a good win.

Unfortunately, I am unclear if such a matcher exists. Would it be possible for us to only watch files with the following extensions? .css .scss .sass ?


Some recent micro-optimizations that yield a nice boost: (reducing costs of stats + crawls by 2x), but ^ would be a substantial win in many cases.

part 1: https://github.com/aexmachina/broccoli-sass-source-maps/pull/5 part 2: https://github.com/ember-cli/broccoli-caching-writer/pull/58

stefanpenner avatar Sep 16 '15 02:09 stefanpenner

Hey Stef, I've added you to this repo as well.

simonexmachina avatar Sep 17 '15 02:09 simonexmachina

@stefanpenner only watching app/styles would make pod styles difficult to handle, would it not? We shouldn't make users manually enter every pod they use.

elwayman02 avatar Oct 24 '15 00:10 elwayman02

Any progress on this issue @stefanpenner?

simonexmachina avatar Apr 11 '16 23:04 simonexmachina

Do you have any agreement on what an API would look like? I'm keen to help implement this as this bottleneck is adding 30 seconds to my cold starts (when using npm linked modules) and 2-3 seconds to each rebuild.

dmfenton avatar Oct 05 '16 21:10 dmfenton

I hacked together an addon that passes a tree containing only /app/styles to this addon. This effectively allows me to control exactly what goes into my sass pipeline. It sped up my cold builds by 1/3rd and rebuilds by 2/3rds.

https://github.com/dmfenton/ember-cli-prune-style-tree

dmfenton avatar Oct 06 '16 21:10 dmfenton

@dmfenton @stefanpenner would be the best person to ask about this. Stef any thoughts on this? Is there someone else that would be good to speak to about this?

simonexmachina avatar Oct 10 '16 05:10 simonexmachina

Are there any updates on this one? ember-cli-prune-style-tree doesn't seem to be a drop-in solution for us.

tamzinblake avatar Dec 01 '17 22:12 tamzinblake

@stefanpenner Any news?

tamzinblake avatar Feb 28 '18 18:02 tamzinblake

Thanks to @dmfenton's addon our rebuild times were reduced by 2/3 (from about 7 seconds to about 2). This should be part of ember-cli-sass!

ctusch avatar Mar 01 '18 10:03 ctusch

Sounds interesting. Can you send a link and we'll have a look.

-- Simon Wade - Chief Technical Officer jtribe - love your apps 13/243 Collins Street, Melbourne VIC 3000 [email protected] | +61 422 777 262 <+61422777262> | http://jtribe.com.au

simonexmachina avatar Mar 01 '18 10:03 simonexmachina

It's the one he posted above: https://github.com/dmfenton/ember-cli-prune-style-tree

I'm not sure if it works for every use case but we haven't had any problems with it.

ctusch avatar Mar 01 '18 12:03 ctusch

We just had problems with compiling in-repo-addon styles using the app's outputPaths option. After some debugging I remembered installing above mentioned ember-cli-prune-style-tree addon. It only allows styles in the app directory to be compiled. So beware. If other people should run into the same problem here is what the error message looks like:

File not found: \app\styles\themes\addon\app.scss
in any of the following include paths:
...\tmp\sass_compiler-input_base_path-PuGpRr2a.tmp

ctusch avatar Nov 22 '18 12:11 ctusch