Optimize the parsing of unquoted attributes #155
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of handling each char one by one, we read them in batch until a char for which we need a special handling (chars ending the attribute value, references and chars needing to throw an error).
I ran the loading benchmark on a modified fixture file in which I unquoted all class attributes containing a single class (this kind of replacement was the easiest to do).
Before: 116.11662387848
After: 114.08836126328
There is no difference on the unmodified benchmark, because it uses quoted attributes everywhere.