-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
It is generally true that each HTML entity has a greater length in bytes than its Unicode symbol.
Which makes it possible to modify the string or vec buffer directly without an extra allocation.
All but two entities are as long or longer than their expansion, so allocating the output buffer to be the same size as the input will usually prevent multiple allocations and generally won’t over-allocate by very much.
The two entities are
⋙̸(⋙̸) and⋘̸(⋘̸) which are both five byte entities with six byte expansions.
As these two are extremely rear I would not bother with them as it is performance vs. purity trade-off.
- these symbols could be mapped to ≪̸ which is semantically close
- the function could signal about its incompleteness
- the function could switch to the classical implementation for the rest of the string
Thanks for the great work you've done! 👍🏻
Metadata
Metadata
Assignees
Labels
No labels