8a8d1233bb6b9afad122a2c66a54be3826642458
~/s/g/p/g/benchmark$ go test -bench=. goos: linux goarch: amd64 pkg: github.com/pelletier/go-toml/v2/benchmark cpu: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz BenchmarkUnmarshalSimple/v2-8 1607115 742.0 ns/op BenchmarkUnmarshalSimple/v1-8 307977 3915 ns/op BenchmarkUnmarshalSimple/bs-8 516754 2330 ns/op BenchmarkReferenceFile/v2-8 9604 129158 ns/op 111422 B/op 1381 allocs/op BenchmarkReferenceFile/v1-8 4521 263808 ns/op 130566 B/op 2649 allocs/op BenchmarkReferenceFile/bs-8 4070 296271 ns/op 80784 B/op 1729 allocs/op PASS ok github.com/pelletier/go-toml/v2/benchmark 8.139s
go-toml V2
Development branch. Probably does not work.
Must do
- Unmarshal into maps.
- Support Array Tables.
- Unmarshal into pointers.
- Support Date / times.
- Support struct tags annotations.
- Support Arrays.
- Support Unmarshaler interface.
- Original go-toml unmarshal tests pass.
- Benchmark!
- Abstract AST.
- Attach comments to AST (gated by parser flag).
- Track file position (line, column) for errors.
- Benchmark again!
Further work
- Rewrite AST to use a single array as storage instead of one allocation per node.
- Provide "minimal allocations" option that uses
unsafeto reuse the input byte array as storage for strings. - Cache reflection operations per type.
Ideas
- Allow types to implement a
ASTUnmarshalerinterface to unmarshal straight from the AST?
License
The MIT License (MIT). Read LICENSE.
Description
Languages
Go
94.6%
Shell
5.4%