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

Aperta
#3,106 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
haskell
Ambito
performance

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Haskell
Stelle
926
Fork
71
Merge medio
6h 49m
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di composewell/streamly

Tutte le issue di composewell/streamly

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.