TextEncoder and TextDecoder performance concern around all libraries / runtimes
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 22/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- api, performance, web-dev
Direzione di ricerca
Start with the linked comment on issue 333 and compare the reported TextEncoder and TextDecoder performance concerns across the runtimes and libraries named in the issue. Determine whether the result should be an implementation investigation or a new Encoding Standard API proposal; done requires a reproducible performance comparison and a clearly scoped outcome.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What is the issue with the Encoding Standard?
I've been asked to file a new issue after this comment https://github.com/whatwg/encoding/issues/333#issuecomment-2724225478 and here I am doing that:
- no runtime on the server prefers standards API to convert JS UTF-16 based strings into UTF-8 compatible strings, yet our Operating Systems, files, the Web itself, runs over UTF-8 to maximize compatibility with all Programming Languages and avoid misleading, or error prone, conversions all over the place
- no library which goal is to serialize as binary data JS uses TextEncoder or TextDecoder if not just after trying to avoid both by all means because these are extremely slow, via
encodeIntovariants or not, compared to more or less accurate JS only solutions - all JS only solutions are fast enough with laptops plugged in, but overall CPUs degrade 5X+ performance once devices are in battery save mode ... or better, all libraries perform extremely bad out of just JS code and it's not clear why these APIs are so slow compared to NodeJS, Bun or other JS runtime solutions that are not based on these APIs
- if all server runtimes need to avoid these APIs and SharedArrayBuffer + Atomics is used to convert JS references otherwise impossible to convert natively as binary, it's clear to me we're lacking a primitive which only purpose would be to return a buffer out of
String.prototype.toUTF8Buffer()or any other named API which goal is to just do that without all the performance caveats behind the scene - at the same time, it's not clear why every JS solution literally outperform these native APIs so that something might be really off behind these API implementations, as most libraries are based on RFC standards and has been proven to work for years bypassing TextEncoder or TextDecoder usage
As summary, it would be great to understand why these APIs are so slow and why there is no interest in having best performance backed in to transform strings as binary data and decode these.
Use cases:
- Atomics via SharedArrayBuffer where the only language these APIs speak is binary and views of buffers
- cross posting + cross programming language communication
- file handling where all APIs returns
arrayBufferbut that's both async (usually) and yet needs conversion to text too if these are traveling - leader tab patterns used to enable OPFS where data can only travel as binary to be fast enough, avoiding any encoding/decoding all over the place (buffers travel fast)
- serialization where to know the length of a JS string we need all sort of invariants to what
byteLengthcould provide and yet, that would not solve the whole issue: we also need/want that buffer after
Thanks in advance for considering any alternative API that would boost performance or considering investigating how come we need to loop charCodeAt all over the Web to be sure we're either faster than native APIs, which goal supposed to be to simplify that encoding/decoding dance, or needed to compute the resulting length of a JS string, usually before needing that string as buffer anyway 🙏
- Lingua principale
- HTML
- Stelle
- 323
- Fork
- 94
- Merge medio
- 21m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di whatwg/encoding
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
topic: api
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
topic: api
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
-
Add support for [AllowResizable] inputsForse già presa @daxpedda l’ha presa 223 giorni fa. Apertaaddition/proposal topic: api
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
addition/proposal needs implementer interest
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Tutte le issue di whatwg/encoding
Issue simili
-
Context/namespace resources fail in-cluster: "Invalid kube-config file. No configuration found."Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug review needed
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
OpenMage/magento-lts#5816 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
libsdl-org/SDL#16607 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
swc-project/swc-next#1165 ·
I maintainer di solito rispondono entro 1 giorno
-
app: scripts severity: low status: backlog type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
netbox-community/netbox-scripts#64 ·
I maintainer di solito rispondono entro 1 giorno