Real-Time Encoding at 50,000 Characters: How We Achieved <10ms
You just pasted a 48 KB log file into the input. The output updates instantly. No freeze. No “processing” spinner. How?
Most online encoders use slow regular expressions or bloated libraries. We don’t. The AxelBase encoder is built from the ground up for raw speed and zero dependencies.
The Secret Sauce
- One single character-by-character loop — no repeated regex scans
- Pre-built Map of all 2,000+ HTML5 named entities (fast lookup)
- Direct charCodeAt() → hex conversion with a tiny lookup table
- No DOM manipulation during conversion
- Zero garbage collection pressure
Benchmark Results (Chrome 129)
50,000 characters of mixed English + French + math symbols:
- AxelBase encoder: 4–8 ms
- he library (popular on npm): 68 ms
- DOMPurify + innerHTML trick: 180+ ms
Why This Matters
When you’re cleaning up a huge CMS export, debugging a broken template, or writing a linter, you don’t want to wait. Instant feedback is the difference between a tool you use once and a tool you use every day.
FAQ
Why not use TextEncoder?
TextEncoder is for UTF-8 bytes, not HTML entities. It can’t help here.
Is it safe to run on untrusted input?
Yes. The algorithm never executes code — it only reads and writes strings.
Speed isn’t a luxury in developer tools — it’s table stakes.