Hi folks,

I'm working on a course grained css parser, and I've noticed that parsing css 
comments swamps my performance. Can anyone give me a hand and point out if I'm 
doing something silly? As well as any tips on how to approach optimizing a 
parser.

https://gist.github.com/zmoazeni/9208f594bdf61aed1419

https://gist.github.com/zmoazeni/9208f594bdf61aed1419#file-file-with-comments-css
 (file with comments) takes ~20 seconds to parse on my machine while 
https://gist.github.com/zmoazeni/9208f594bdf61aed1419#file-file-without-comments-css
 (file without comments) takes ~3 seconds.

I'm surprised that the comments ruin the performance so dramatically. This 
obviously gets much worse as the css file gets larger.

I appreciate any help,

Thanks!
-Zach

Reply via email to