-
Notifications
You must be signed in to change notification settings - Fork 6
classes: Dedupe all classes #25
base: master
Are you sure you want to change the base?
Conversation
For escapeAlways, couldn't we just check equality to true? In terms of performance, I ran some benchmarks and the only to speed it up
|
One option would be to enable only in dev-mode and throw errors rather than deduping? |
Err… I don't see the point in that. Throwing errors prevents a perfectly okay use-case that allows more flexibility. Plus, to throw errors we have to first check for dups, so no performance gains can be reaped from this approach either. |
I did benchmark Sets but it was done on an older, slower version of the patch that didn't share the output object, so no performance gains were achieved. I'll test some more. |
a4b372b
to
33a32e9
Compare
This causes a slow down especially on cases with simple string-only arrays, but this is the best I can do. Optimization welcome.
33a32e9
to
010d986
Compare
Nah, Set is still a lot slower. I also added another optimization that prevents a branch
Derp. Fixed. |
The advantage of throwing on dupes is that we could do all the deduping inside I'm not saying it's the best thing to do, just that it's an option. |
That's a good point - do we actually want to check for dupes? It is valid html to print classes more than once and we do take a hit for these extra checks. |
This causes a slow down especially on cases with simple string-only arrays (~3×), but this is the best I can do. Optimization welcome.