On non-Node.js without XHR+Blob, this uses Buffer polyfill when available. And Buffer polyfill is slow and buggy.
Specific issue:
delete globalThis.TextDecoder
delete globalThis.TextEncoder
require('fast-text-encoding')
console.log(new TextDecoder().decode(Uint8Array.of(0xf0, 0x90, 0x80)).length)
console.log(new TextEncoder().encode('\ud800\ud800'))
Node.js:
1
<Buffer ef bf bd ef bf bd>
Hermes:
Also, why does it return Buffer instances?
And without Buffer global this is even worse:
delete globalThis.TextDecoder
delete globalThis.TextEncoder
delete globalThis.Buffer
require('fast-text-encoding')
console.log(new TextDecoder().decode(Uint8Array.of(0xf0, 0x90, 0x80)).length)
console.log(new TextEncoder().encode('\ud800\ud800'))
On non-Node.js without XHR+Blob, this uses Buffer polyfill when available. And Buffer polyfill is slow and buggy.
Specific issue:
Node.js:
Hermes:
Also, why does it return Buffer instances?
And without
Bufferglobal this is even worse: