Thomas Pelletier
f2378983d9
encoder: added test for #287
2021-04-08 10:24:38 -04:00
Thomas Pelletier
37714006b6
V2 Marshaler MVP ( #495 )
2021-04-08 10:07:29 -04:00
Thomas Pelletier
275e366c17
decoder: handle casting local date into time.Time
...
Refs #494
2021-04-08 08:00:31 -04:00
Vincent Serpoul
18af62d3ea
Golangci-lint v2 part one ( #492 )
2021-04-07 13:39:01 -04:00
jidicula
af00765ca0
Address golangci-lint warnings in unmarshal_imported_test.go ( #493 )
...
* refactor(tracker): Remove unreachable return
* refactor(unmarshal_imported_test): Mark unused camelCase test
golangci-lint indicates `TestUnmarshalCamelCaseKey` as unused (it's
currently skipped).
* refactor(unmarshal_imported_test): Mark unused type
golangci-lint indicates `customPointerMarshaler` as unused.
* refactor(unmarshal_imported_test): Mark unused type
golangci-lint indicates `textPointerMarshaler` as unused.
* refactor(unmarshal_imported_test): Mark unused type
golangci-lint indicates `precedentMarshaler` and its methods as
unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `testDurationToml2` as unused.
* refactor(unmarshal_imported_test): Mark unused type
golangci-lint indicates `testBadDuration` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `testDurationToml` as unused.
* refactor(unmarshal_imported_test): Mark unused type
golangci-lint indicates `testDuration` as unused.
* refactor(unmarshal_imported_test): Mark unused type
golangci-lint indicates `testDocCustomTag` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `testDocCustomTagData` as unused.
* refactor(unmarshal_imported_test): Mark unused type
golangci-lint indicates `testDocBasicsCustomTag` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `testDocBasicToml` as unused.
* refactor(unmarshal_imported_test): Mark unused type
golangci-lint indicates `structArrayNoTag` as unused.
* refactor(unmarshal_imported_test): Mark unused type
golangci-lint incorrectly indicates `check` as unused.
* refactor(unmarshal_imported_test): Mark unused struct field
golangci-lint indicates `testDoc.err` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `customMultilineTagTestToml` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `customCommentedTagTestToml` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `customCommentTagTestToml` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `customTagTestToml` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `mapsTestToml` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `mapsTestData` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `commentTestToml` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `nestedCustomMarshalerToml` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `nestedCustomMarshalerData` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `customMarshalerToml` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `mapTestDoc` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `quotedKeyMarshalTestToml` as unused.
* refactor(unmarshal_imported_test): Mark unused var
golangci-lint indicates `quotedKeyMarshalTestData` as unused.
2021-04-05 14:30:17 -04:00
Cameron Moore
5f877c52fd
Add additional dataset to benchmarks ( #490 )
...
Adding several files to stress test the unmarshaller. Most were
converted from JSON so they may not be very realistic use cases.
```
goos: linux
goarch: amd64
pkg: github.com/pelletier/go-toml/v2/benchmark
cpu: Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
BenchmarkUnmarshalDataset/config/v2-2 16 66339063 ns/op 15.81 MB/s 16850159 B/op 645454 allocs/op
BenchmarkUnmarshalDataset/config/v1-2 7 147289186 ns/op 7.12 MB/s 60669811 B/op 870486 allocs/op
BenchmarkUnmarshalDataset/config/bs-2 12 88966009 ns/op 11.79 MB/s 29949268 B/op 705573 allocs/op
BenchmarkUnmarshalDataset/canada/v2-2 8 145433377 ns/op 15.14 MB/s 74282227 B/op 895641 allocs/op
BenchmarkUnmarshalDataset/canada/v1-2 3 434913677 ns/op 5.06 MB/s 138664290 B/op 1897300 allocs/op
BenchmarkUnmarshalDataset/citm_catalog/v2-2 19 55256979 ns/op 10.10 MB/s 37122952 B/op 369492 allocs/op
BenchmarkUnmarshalDataset/citm_catalog/v1-2 10 110343191 ns/op 5.06 MB/s 54743595 B/op 727704 allocs/op
BenchmarkUnmarshalDataset/citm_catalog/bs-2 21 51634081 ns/op 10.81 MB/s 17196872 B/op 325830 allocs/op
BenchmarkUnmarshalDataset/twitter/v2-2 50 26660937 ns/op 16.57 MB/s 15580238 B/op 156394 allocs/op
BenchmarkUnmarshalDataset/twitter/v1-2 30 43128488 ns/op 10.25 MB/s 21203420 B/op 266110 allocs/op
BenchmarkUnmarshalDataset/twitter/bs-2 48 27337976 ns/op 16.16 MB/s 8795405 B/op 145370 allocs/op
BenchmarkUnmarshalDataset/code/v2-2 4 276279202 ns/op 9.71 MB/s 59293948 B/op 2907227 allocs/op
BenchmarkUnmarshalDataset/code/v1-2 3 421910642 ns/op 6.36 MB/s 161733770 B/op 2478194 allocs/op
BenchmarkUnmarshalDataset/code/bs-2 4 323158157 ns/op 8.31 MB/s 133056988 B/op 1439475 allocs/op
BenchmarkUnmarshalDataset/example/v2-2 2444 479553 ns/op 16.89 MB/s 237606 B/op 3609 allocs/op
BenchmarkUnmarshalDataset/example/v1-2 1321 911995 ns/op 8.88 MB/s 377502 B/op 6133 allocs/op
BenchmarkUnmarshalDataset/example/bs-2 1898 555649 ns/op 14.58 MB/s 178485 B/op 3362 allocs/op
BenchmarkUnmarshalSimple/v2-2 896760 1200 ns/op
BenchmarkUnmarshalSimple/v1-2 207364 6070 ns/op
BenchmarkUnmarshalSimple/bs-2 420952 2925 ns/op
BenchmarkReferenceFile/v2-2 29473 39433 ns/op 132.93 MB/s 11812 B/op 253 allocs/op
BenchmarkReferenceFile/v1-2 2823 361383 ns/op 14.51 MB/s 136470 B/op 2745 allocs/op
BenchmarkReferenceFile/bs-2 3097 391116 ns/op 13.40 MB/s 80795 B/op 1729 allocs/op
PASS
ok github.com/pelletier/go-toml/v2/benchmark 34.255s
```
2021-04-01 10:13:13 -04:00
Thomas Pelletier
92b16cad91
Simplify context implementation and fix new lines bug
2021-03-31 09:57:19 -04:00
Thomas Pelletier
4a4c2c2a5f
Update readme
2021-03-31 09:15:33 -04:00
Thomas Pelletier
5d905981cf
CI: add dependabot
2021-03-30 22:03:39 -04:00
Thomas Pelletier
7ccacf158e
Test for #252
2021-03-30 21:53:01 -04:00
Thomas Pelletier
739ceda96c
Move github pull request template
2021-03-30 21:45:43 -04:00
Thomas Pelletier
32da85ab11
Decoding error position tracking
2021-03-30 21:43:57 -04:00
Thomas Pelletier
18d45c446b
wip: decoder errors
2021-03-30 19:52:02 -04:00
Thomas Pelletier
bcd5333b03
Enable ci on v2-wip branch pull requests
2021-03-30 12:38:26 -04:00
Cameron Moore
e5255a5be2
Set bytes in ReferenceFile benchmark to show throughput results ( #489 )
2021-03-30 12:34:25 -04:00
Thomas Pelletier
cf288a51c5
Wip errors reporting
2021-03-30 10:59:35 -04:00
Thomas Pelletier
72a1afdcb2
Add some unsafe helper to track errors
2021-03-29 22:33:28 -04:00
Thomas Pelletier
2714786b37
Add decoder interface
2021-03-29 21:30:41 -04:00
Thomas Pelletier
51d78a5f0c
Fix unmarshaling of literal keys
...
Ref #427 .
2021-03-29 20:58:51 -04:00
Thomas Pelletier
78389c641a
Test for #475
2021-03-29 20:46:09 -04:00
Thomas Pelletier
c3fc668f27
Test for #458
2021-03-29 20:38:48 -04:00
Thomas Pelletier
7f016efe03
Test for #484
2021-03-29 20:28:51 -04:00
Thomas Pelletier
269b742eb2
Enable race condition detector in CI
2021-03-29 20:17:05 -04:00
Cameron Moore
7d8ea80dc3
Fix scanning of float with leading zero ( #486 )
2021-03-29 20:07:26 -04:00
Cameron Moore
6165b9454f
Identify test helper functions ( #487 )
2021-03-29 20:06:46 -04:00
Thomas Pelletier
2ddbf6be6d
Implement duplicate and key types check
2021-03-29 10:45:50 -04:00
Thomas Pelletier
da21b0aecf
wip: correctness pass on the AST
2021-03-28 22:12:19 -04:00
Thomas Pelletier
829c005784
Fix unicode decoding
2021-03-28 11:03:43 -04:00
Thomas Pelletier
b24eb93e8e
Fix literal multiline parsing
2021-03-28 00:23:50 -04:00
Thomas Pelletier
7dc5550057
Fix multiline basic string parsing
2021-03-28 00:17:58 -04:00
Thomas Pelletier
9a436c7eeb
Remove logging in test
2021-03-28 00:06:40 -04:00
Thomas Pelletier
72c999ecbf
Fix trailing commas in arrays
2021-03-28 00:04:25 -04:00
Thomas Pelletier
e5a091a092
Don't depend on my computer path
2021-03-27 23:43:24 -04:00
Thomas Pelletier
317b36b24b
Add back license
2021-03-26 09:53:21 -04:00
Thomas Pelletier
636a75f316
Import tomltestgen
...
Handful are failing.
2021-03-26 09:51:35 -04:00
Thomas Pelletier
390927a0cd
Reuse AST storage between top-level expressions
...
```
Comparing:
old: v2-wip/1da2fc7 (2021-03-25 20:38:05 -0400 -0400)
run: v2-wip/3f23ab9 (2021-03-25 22:35:06 -0400 -0400)
-----------------------------------------------------------
name old time/op new time/op delta
UnmarshalSimple/v2-8 700ns ± 3% 705ns ± 2% ~ (p=0.690 n=5+5)
UnmarshalSimple/v1-8 3.85µs ± 1% 4.02µs ± 4% +4.19% (p=0.032 n=5+5)
UnmarshalSimple/bs-8 2.34µs ± 2% 2.38µs ± 3% ~ (p=0.310 n=5+5)
ReferenceFile/v2-8 32.2µs ±13% 23.9µs ± 1% -25.79% (p=0.008 n=5+5)
ReferenceFile/v1-8 270µs ± 2% 264µs ± 2% ~ (p=0.095 n=5+5)
ReferenceFile/bs-8 291µs ± 0% 294µs ± 0% +0.88% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
ReferenceFile/v2-8 37.1kB ± 0% 6.7kB ± 0% -81.91% (p=0.008 n=5+5)
ReferenceFile/v1-8 131kB ± 0% 131kB ± 0% ~ (p=0.444 n=5+5)
ReferenceFile/bs-8 80.8kB ± 0% 80.8kB ± 0% ~ (p=0.571 n=5+5)
name old allocs/op new allocs/op delta
ReferenceFile/v2-8 152 ± 0% 148 ± 0% -2.63% (p=0.008 n=5+5)
ReferenceFile/v1-8 2.65k ± 0% 2.65k ± 0% ~ (all equal)
ReferenceFile/bs-8 1.73k ± 0% 1.73k ± 0% ~ (all equal)
~/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 1692444 710.7 ns/op
BenchmarkUnmarshalSimple/v1-8 307609 3862 ns/op
BenchmarkUnmarshalSimple/bs-8 520429 2285 ns/op
BenchmarkReferenceFile/v2-8 50395 24006 ns/op 6704 B/op 148 allocs/op
BenchmarkReferenceFile/v1-8 4144 264655 ns/op 130567 B/op 2649 allocs/op
BenchmarkReferenceFile/bs-8 3969 293635 ns/op 80784 B/op 1729 allocs/op
PASS
ok github.com/pelletier/go-toml/v2/benchmark 8.143s
```
2021-03-25 22:37:16 -04:00
Thomas Pelletier
3f23ab97e0
Revert os/go version to fit in github pop-up
2021-03-25 21:16:31 -04:00
Thomas Pelletier
47611ff9ea
Shorter names for CI
2021-03-25 21:14:59 -04:00
Thomas Pelletier
f4ac7f7bfa
Multi OS testing
2021-03-25 21:12:19 -04:00
Thomas Pelletier
e75f23188d
Add v2-wip to codeql branches
2021-03-25 21:08:03 -04:00
Thomas Pelletier
6c8adbcb17
Remove azure pipeline
2021-03-25 21:06:54 -04:00
Thomas Pelletier
ffc7d3ba6e
Port codeql
2021-03-25 21:06:34 -04:00
Thomas Pelletier
4efec6b76a
Add github actions workflow
2021-03-25 21:05:07 -04:00
Thomas Pelletier
0fcf06e374
Update todo
2021-03-25 20:49:27 -04:00
Thomas Pelletier
1d332cd112
Add documentation for the AST
2021-03-25 20:46:31 -04:00
Thomas Pelletier
9d3a912da0
Remove unused interface
...
Comparing:
old: v2-wip/17299c9 (2021-03-25 20:19:40 -0400 -0400)
run: v2-wip/1da2fc7 (2021-03-25 20:38:05 -0400 -0400)
-----------------------------------------------------------
name old time/op new time/op delta
UnmarshalSimple/v2-8 755ns ± 3% 700ns ± 3% -7.26% (p=0.008 n=5+5)
UnmarshalSimple/v1-8 3.87µs ± 0% 3.85µs ± 1% ~ (p=0.254 n=4+5)
UnmarshalSimple/bs-8 2.44µs ± 4% 2.34µs ± 2% ~ (p=0.056 n=5+5)
ReferenceFile/v2-8 33.5µs ± 7% 32.2µs ±13% ~ (p=0.421 n=5+5)
ReferenceFile/v1-8 269µs ± 3% 270µs ± 2% ~ (p=1.000 n=5+5)
ReferenceFile/bs-8 296µs ± 2% 291µs ± 0% ~ (p=0.095 n=5+5)
name old alloc/op new alloc/op delta
ReferenceFile/v2-8 38.9kB ± 0% 37.1kB ± 0% -4.77% (p=0.008 n=5+5)
ReferenceFile/v1-8 131kB ± 0% 131kB ± 0% ~ (all equal)
ReferenceFile/bs-8 80.8kB ± 0% 80.8kB ± 0% ~ (p=0.841 n=5+5)
name old allocs/op new allocs/op delta
ReferenceFile/v2-8 181 ± 0% 152 ± 0% -16.02% (p=0.008 n=5+5)
ReferenceFile/v1-8 2.65k ± 0% 2.65k ± 0% ~ (all equal)
ReferenceFile/bs-8 1.73k ± 0% 1.73k ± 0% ~ (all equal)
2021-03-25 20:38:45 -04:00
Thomas Pelletier
1da2fc7e28
Minimal shared cache for struct field paths
2021-03-25 20:19:58 -04:00
Thomas Pelletier
17299c937b
Update readme
2021-03-25 19:56:40 -04:00
Thomas Pelletier
1bae751a45
Linear array storage for AST
2021-03-25 19:56:02 -04:00
Thomas Pelletier
8a8d1233bb
First benchmark!
...
~/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
2021-03-24 22:15:12 -04:00