Parser can be slow
Closed this issue · 3 comments
kneath commented
Since we're using the full SCSS parser on each call, producing a Parser object can end up being really slow. Need to look into either partial SCSS compilation, or caching the result of the parser somehow.
kneath commented
Another idea I had here: write my own comment parser. That way I can just take in any LESS/SCSS/CSS files, ignore all of the rules, and just grab the comments. I'm thinking this might be a better route long term.
kneath commented
Looks like my comment parser idea totally worked here. These aren't perfect tests, but I repeated them several times and got similar numbers.
Before
~/src/kneath/kss (old)$ time ruby -I lib -rubygems -rkss -e 'Kss::Parser.new("/Users/kneath/src/github/github/public/stylesheets/github")'
real 0m2.217s
user 0m2.135s
sys 0m0.076s
With comment parser
~/src/kneath/kss (master)$ time ruby -I lib -rubygems -rkss -e 'Kss::Parser.new("/Users/kneath/src/github/github/public/stylesheets/github")'
real 0m0.084s
user 0m0.075s
sys 0m0.008s
tmm1 commented
❤️