v3.0.0
entities@3.0.0
features more configurable encode
and decode
functions and rewritten decode & encode functions, resulting in a huge speedup.
New Features:
- feat: Add new API for
encode
,decode
functions 817ae67
You can now pass an object with additional configuration options to the exported encode
and decode
function. You can still use the relevant function directly, but this will make it easier to figure out what you want to do in the first place!
Refactors:
- refactor(encode): Use trie for encoding (#559) f6f7cd9
- refactor(decode): Use serialised binary trie for decoding (#556, #557) 267d32e c038c63
entities
is now using tries for encoding and decoding entities. Especially when decoding, this leads to considerable performance improvements. The simple benchmark in scripts/benchmark.ts
is useful for comparing the performance of these two versions:
Version | decode perf |
encode perf |
escape perf |
---|---|---|---|
3.0.0 | 1.418s | 6.786s | 2.196s |
2.2.0 | 4.085s | 14.842s | 5.166s |
Speedup | 2.9x | 2.1x | 2.4x |
Heroes of this release:
- @inikulin for his work on binary decoding tries for the parse5 project, which was the basis for the decode trie implemented in this project.
- @mdevils for being a great opponent in entity library performance.
entities
was the fastest library in the space for a while. The friendly competition was a great reason to come up with smarter algorithms to push the envelope just a bit further. Nowentities
is on top again, but we'll see how long that lasts!