Enable ArrayBuffer Transfer via postMessage for Improved Performance
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
- Área
- frontend
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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;
- Lenguaje dominante
- TypeScript
- Estrellas
- 210
- Forks
- 88
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de reddit/devvit
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
requestExpandedMode(event, "game") does not switch inline webview to the game entrypoint in PlaytestAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Todos los issues de reddit/devvit
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
diegosouzapw/OmniRoute#14869 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 94/100
Los mantenedores suelen responder en 1 día
-
status: waiting triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
freeCodeCamp/freeCodeCamp#70412 ·
Los mantenedores suelen responder en 1 día
-
Mend: dependency security vulnerability untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
opensearch-project/OpenSearch-Dashboards#12816 ·
Los mantenedores suelen responder en 1 día