Skip to content

rovaughn/fastcsv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastcsv

CSV parser for golang that aims to be as fast as possible through the use of mmap and happens to provide a convenient interface.

Example usage:

var record struct {
    Name []byte `csv:"name"`
    Age  []byte `csv:"age"`
    Sex  []byte `csv:"sex"`
}

reader, err := NewFileReader("file.csv", ',', &record)
if err != nil {
    panic(err)
}
defer reader.Close()

for reader.Scan() {
    fmt.Printf("%s|%s|%s\n", record.Name, record.Age, record.Sex)
}

This setup currently gets 3.01 ns/row on my laptop, whereas the standard library gets 1872 ns/row. This can be tested with go test -bench=..

BUG: Currently the reader does not implemented the csv spec correctly yet; namely it does not handle quoted fields or escaped characters. It also always assumed rows are terminated by LF instead of CRLF.

About

Fast CSV reader for golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published