stylus / nib

Stylus mixins, utilities, components, and gradient image generation
http://stylus.github.io/nib
MIT License
1.91k stars 249 forks source link

stylus renders slow with nib #254

Open acidjazz opened 10 years ago

acidjazz commented 10 years ago

benchmark results for a core i5 -> all files have 100+ lines of code and 10+ includes

jade compilation: 0.08s stylus compilation: 0.2s stylus with nib compilation: 2.2s

any solutions for this? has nib been profiled?

acidjazz commented 10 years ago

image

profile to possibly help

acidjazz commented 10 years ago

one of the ways I got jade to run so fast was passing an option "self" that wasn't documented. are there any options in stylus not documented I could play with to possible tweak it?

notslang commented 10 years ago

I've never actually noticed any lag when compiling Stylus; other than huge sites like carrot.is, but that's in combination with several other compiled assets. But if you're interested in optimizing nib then I'd be happy to work with you on it. However, I don't know of any undocumented Stylus options like that.

Also, I'd love to hear more about that 'self' option in Jade.

acidjazz commented 10 years ago

Thanks @slang800 ,

As far as Jade goes, the trick I found is if you pass "self" as true as a render option and then refer to all variables passed to jade as self.??? then you get a 100x performance increase. This was a huge find when I stress tested my jade. In fact w/out this optimization, operations was about to pick a pretty big fight on jade being the major bottleneck, and a very measurable cost in hosting.

Here is where they found and added it

https://github.com/visionmedia/jade/pull/217

acidjazz commented 10 years ago

@slang800 as far as stylus goes, after doing more playing around i noticed the difference in load time is about the same even w/ no css, so an empty .styl file w/out a nib include was 0.02s load time, w/ a nib include 0.1s load time. Then as I added lines of stylus code the nib included load time increases little by little.

amwmedia commented 9 years ago

I was able to speed up stylus by first concatenating the styl files into 1. That way nib only has to load once.

http://blog.amwmedia.com/post/110919529872/speeding-up-stylus-with-grunt-contrib-concat