hPutBuf is expensive, need a better alternative/implementation for faster fileio

Abierto
#3,106 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
haskell
Área
performance

Línea de trabajo

Start with the linked BasicDirStream.hsc example and compare the hPutBuf call with the C printf case for small console writes. The issue calls for an API or implementation that supplies a buffer directly to the kernel, but does not identify a target file or tests. Done means providing a faster approach for frequent small writes and showing its performance against the current path.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

aspect:filesystem type:performance

See this example . If we compare the C printf with our print statement using hPutBuf it performs poorly.

    printName arr off = do
        -- If we use an Array then we can use a slice of the same
        -- buffer for printing and for passing to loopDir.
        MutByteArray.pokeAt off arr (10 :: Word8)
        -- hPutBuf is quite expensive compared to C printf.
        -- There should be an API that supplies the buffer directly to kernel.
        -- And we can build a buffer in the loop here and write it when it is
        -- ready.
        MutByteArray.unsafeAsPtr arr $ \p ->
            hPutBuf stdout p (off+1)

This matters only if we use it too often for small data printing. This is a common case for routine printing on console.

Lenguaje dominante
Haskell
Estrellas
926
Forks
71
Merge medio
6 h 49 min
PR fusionados (30 d)
3

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de composewell/streamly

Todos los issues de composewell/streamly

Issues similares

Más issues de Haskell

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.