Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go bytesconv package

This repository contains a bytesconv package for Go. It's only use for now is to provide an AtoI function using generics that reads from a []byte and does so much faster than strconv.Atoi.

Performane

    BenchmarkAtou
    BenchmarkAtou/short
    BenchmarkAtou/short-12                  371885434                3.177 ns/op           0 B/op          0 allocs/op
    BenchmarkAtou/medium
    BenchmarkAtou/medium-12                 173695776                6.938 ns/op           0 B/op          0 allocs/op
    BenchmarkAtou/long
    BenchmarkAtou/long-12                   97804930                12.24 ns/op            0 B/op          0 allocs/op
    BenchmarkAtoi
    BenchmarkAtoi/short
    BenchmarkAtoi/short-12                  309318704                3.852 ns/op           0 B/op          0 allocs/op
    BenchmarkAtoi/medium
    BenchmarkAtoi/medium-12                 166366285                7.201 ns/op           0 B/op          0 allocs/op
    BenchmarkAtoi/long
    BenchmarkAtoi/long-12                   94370470                12.85 ns/op            0 B/op          0 allocs/op
    BenchmarkAtoi/negshort
    BenchmarkAtoi/negshort-12               275667990                4.332 ns/op           0 B/op          0 allocs/op
    BenchmarkAtoi/negmedium
    BenchmarkAtoi/negmedium-12              156501042                7.632 ns/op           0 B/op          0 allocs/op
    BenchmarkAtoi/neglong
    BenchmarkAtoi/neglong-12                89634883                13.05 ns/op            0 B/op          0 allocs/op
    BenchmarkStrconvAtoi
    BenchmarkStrconvAtoi/short
    BenchmarkStrconvAtoi/short-12           154683451                7.823 ns/op           0 B/op          0 allocs/op
    BenchmarkStrconvAtoi/medium
    BenchmarkStrconvAtoi/medium-12          100000000               11.16 ns/op            0 B/op          0 allocs/op
    BenchmarkStrconvAtoi/long
    BenchmarkStrconvAtoi/long-12            41659606                28.73 ns/op            0 B/op          0 allocs/op
    BenchmarkStrconvAtoi/negshort
    BenchmarkStrconvAtoi/negshort-12        150702853                7.973 ns/op           0 B/op          0 allocs/op
    BenchmarkStrconvAtoi/negmedium
    BenchmarkStrconvAtoi/negmedium-12       90451774                13.31 ns/op            0 B/op          0 allocs/op
    BenchmarkStrconvAtoi/neglong
    BenchmarkStrconvAtoi/neglong-12         40495603                29.70 ns/op            0 B/op          0 allocs/op

Obsolence

This is mostly old code modernized and cleaned up for publication. Even though []byte to string conversion for provable read-only usage became zero-copy and allocation-free since long ago, this package is still useful as it is more than twice as fast as strconv.Atoi.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages