Provide buffer-agnostic interface for the Get monad.
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Haskell
- Estrellas
- 120
- Forks
- 70
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Despite the fact that binary was primary designed with lazy bytestrins in mind, it also very useful for generic serialization with various types of buffers. And it works quite well for Put monad: we have `execPut :: PutM a -> Builder` latter we can run this builder with `runBuilder :: Builder -> BufferWriter` from `Data.ByteString.Builder.Extra` on any type of buffer: the interface requires vanilla pointer of type `Ptr Word8` and also provides information about minimal buffer size and number of bytes written to buffer. This function can be used to generate lazy bytestring, to write directly to device buffer, I use this function to write data to preallocated memory buffer in my application and then to generate strict bytestring from it.
Unfortunately similar functionality for Get monad is missed from the package. The closest function we have is `runGetIncremental :: Get a -> Decoder a` but it still operates on ByteStrings (not on pointers) and it even had serious performance issue until https://github.com/kolmodin/binary/commit/7532daa8789e5199109bb1fcde367d71effb07e2 Even been fixed, it still introduces some overhead by relatively complex handling logic, and this can be noticeable effect on very small Getters (in my application I have a getter which reads 6 bytes, even very small overhead on it affects performance).
I think Decoder should be redesigned to operate on pointers and buffer size information in similar way as `Builder` from the `Data.ByteString` does. Having such interface it would be easy to create ByteString version, as well as any custom buffer reader with minimal overhead.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
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.
Línea de trabajo
Empieza leyendo la interfaz existente runGetIncremental :: Get a -> Decoder a y compárala con execPut, Builder y runBuilder de Data.ByteString.Builder.Extra. Se considera terminado cuando Decoder puede operar con punteros e información sobre el tamaño del búfer, además de admitir una implementación de ByteString y lectores de búfer personalizados con menos sobrecarga.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- haskell
- Área
- data
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 25/100