Enable ArrayBuffer Transfer via postMessage for Improved Performance
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- frontend
Direzione di ricerca
Locate the UseWebViewResult definition and trace the existing postMessage forwarding path into the WebView. Update the interface and forwarding path so an optional Transferable[] is accepted and attached to the message; done means ArrayBuffer data is usable in the WebView without base64 conversion.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
TLDR;
Currently, passing ArrayBuffer data from Devvit to a WebView requires converting it to a base64 string. This workaround significantly increases data size and reduces performance due to unnecessary cloning and data encoding.
Description:
Forwarding raw arrayBuffer received with a fetch request from devvit to the Webview is a great performance improvement, currently the only workaround is to convert data as a base 64 string, which clones and expand the data size.
Transferable objects are commonly used to share resources that can only be safely exposed to a single JavaScript thread at a time. For example, an ArrayBuffer is a transferable object that owns a block of memory. When such a buffer is transferred between threads, the associated memory resource is detached from the original buffer and attached to the buffer object created in the new thread.
The correct solution would be to forward the third argument of postMessage function:
transfer
An optional array of transferable objects to transfer ownership of. The ownership of these objects is given to the destination side and they are no longer usable on the sending side. These transferable objects should be attached to the message; otherwise they would be moved but not actually accessible on the receiving end.
Today, passing an arrayBuffer via postMessage will make it not accessible from within the Webview for the reason above.
The solution would be to change the signature of the postMessage function in UseWebViewResult from:
postMessage(message: To): void;
to:
postMessage(message: To, transfer?: Transferable[]): void;
- Lingua principale
- TypeScript
- Stelle
- 210
- Fork
- 88
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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 reddit/devvit
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
requestExpandedMode(event, "game") does not switch inline webview to the game entrypoint in Playtest Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Tutte le issue di reddit/devvit
Issue simili
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Crush Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
ElementsProject/cln-application#167 · 1 commento · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Quantco/pnpm-licenses#17 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100