Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment using []byte #176

Merged
merged 5 commits into from
Jun 28, 2017
Merged

Conversation

pelletier
Copy link
Owner

@pelletier pelletier commented Jun 4, 2017

Just for the kicks I tried out to:

  1. get rid of the chan communication between parser and lexer
  2. and lex on a []byte instead of a io.Reader

Results are rather impressive:

name                       old time/op    new time/op    delta
ParseToml-8                  1.24ms ± 0%    0.30ms ± 0%  -76.09%
UnmarshalToml-8              1.36ms ± 0%    0.40ms ± 0%  -70.99%
UnmarshalBurntSushiToml-8     398µs ± 0%     374µs ± 0%   -5.89%
UnmarshalJson-8              63.2µs ± 0%    61.3µs ± 0%   -2.98%
UnmarshalYaml-8               179µs ± 0%     187µs ± 0%   +4.41%

name                       old alloc/op   new alloc/op   delta
ParseToml-8                   429kB ± 0%     135kB ± 0%  -68.53%
UnmarshalToml-8               451kB ± 0%     157kB ± 0%  -65.23%
UnmarshalBurntSushiToml-8    82.9kB ± 0%    82.9kB ± 0%   -0.00%
UnmarshalJson-8              3.54kB ± 0%    3.54kB ± 0%    0.00%
UnmarshalYaml-8              44.9kB ± 0%    44.9kB ± 0%    0.00%

name                       old allocs/op  new allocs/op  delta
ParseToml-8                   14.1k ± 0%      3.2k ± 0%  -77.20%
UnmarshalToml-8               15.1k ± 0%      4.2k ± 0%  -72.00%
UnmarshalBurntSushiToml-8     1.76k ± 0%     1.76k ± 0%    0.00%
UnmarshalJson-8                 101 ± 0%       101 ± 0%    0.00%
UnmarshalYaml-8               1.06k ± 0%     1.06k ± 0%    0.00%

That was a quick hack so there are probably other stuff to try out.

@bep @moorereason @kevinburke

Ref #167

Compare go-toml to json and yaml. First results:

BenchmarkUnmarshalToml-8   1000  1263198 ns/op  450912 B/op  15072 allocs/op
BenchmarkUnmarshalJson-8  20000    61568 ns/op    3536 B/op    101 allocs/op
BenchmarkUnmarshalYaml-8  10000   178127 ns/op   44872 B/op   1058 allocs/op
BenchmarkUnmarshalToml-8             1000  1320117 ns/op  450932 B/op  15072 allocs/op
BenchmarkUnmarshalBurntSushiToml-8   3000   402897 ns/op   82900 B/op   1761 allocs/op
BenchmarkUnmarshalJson-8            20000    66092 ns/op    3536 B/op    101 allocs/op
BenchmarkUnmarshalYaml-8            10000   189600 ns/op   44872 B/op   1058 allocs/op
name             old time/op    new time/op    delta
ParseToml-8        1.18ms ± 0%    0.91ms ± 0%  -22.98%
UnmarshalToml-8    1.29ms ± 0%    0.95ms ± 0%  -25.96%

name             old alloc/op   new alloc/op   delta
ParseToml-8         429kB ± 0%     444kB ± 0%   +3.49%
UnmarshalToml-8     451kB ± 0%     466kB ± 0%   +3.32%

name             old allocs/op  new allocs/op  delta
ParseToml-8         14.1k ± 0%     13.7k ± 0%   -2.31%
UnmarshalToml-8     15.1k ± 0%     14.7k ± 0%   -2.16%
name             old time/op    new time/op    delta
ParseToml-8        1.18ms ± 0%    0.29ms ± 0%  -75.18%
UnmarshalToml-8    1.27ms ± 0%    0.38ms ± 0%  -70.38%

name             old alloc/op   new alloc/op   delta
ParseToml-8         429kB ± 0%     135kB ± 0%  -68.53%
UnmarshalToml-8     451kB ± 0%     157kB ± 0%  -65.22%

name             old allocs/op  new allocs/op  delta
ParseToml-8         14.1k ± 0%      3.2k ± 0%  -77.20%
UnmarshalToml-8     15.1k ± 0%      4.2k ± 0%  -72.00%
@pelletier pelletier changed the title Pelletier/experiment with no chan Experiment using []byte Jun 4, 2017
@pelletier pelletier changed the base branch from pelletier/benchmark-unmarshall to master June 25, 2017 20:07
@pelletier pelletier merged commit 69d355d into master Jun 28, 2017
@pelletier pelletier deleted the pelletier/experiment-with-no-chan branch June 28, 2017 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant