Closed Snugug closed 10 years ago
We should probably run tests to see which one is faster but from what I know while
loops perform poorly in Sass. :(
Having done a quick test, the recursive function currently in there compiles 100 multi-depth string replaces in ~.85s
, whereas the while loop does the same in ~0.06s
. There is currently a logic issue somewhere in the while loop, and it doesn't support case sensitivity (both of which would need to be added/fixed), but it's significantly faster than what is written.
On the overall code review side, I would like to see some performance benchmarks for each of the functions currently written. str-replace
is intensive, but as written it's also very slow. As we've seen over the past few projects we've shared code on, taking a different approach to the same problem has the potential to dramatically increase performance, and I'd like to see what the base performance is for each of these and see if it can be improved.
Hey, very good to know Sam. I wonder why the recursive edition performs so slowly compared to the while loop.
Do you have a solution to efficiently measure compilation time?
compass compile --time
I was wondering if there was some kind of a Grunt task for this.
@HugoGiraudel SassMeister does include a compilation time if you ever want to do quick checks
Don't remember why I wrote it this way instead of as a recursive function, but something to look at.