Ah shoot. I realized I forgot to mention some specs. I'm using parslet v1.5.0 on ruby 1.9.3-p385. I'm on a Macbook Air, but I don't think the machine is the issue.
-Zach On Mar 17, 2013, at 7:21 PM, Zach Moazeni wrote: > 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
