From bd5cba0b0b548e8d872a916a9d8983ee17ae6548 Mon Sep 17 00:00:00 2001
From: Thomas Pelletier
Date: Fri, 15 Oct 2021 16:53:40 -0700
Subject: [PATCH] Update benchmarks readme (#630)
* Fix ci.sh for new benchmarks
Nice + taskset are more stable on my machine. We want to excude non high-level
benchmarks. BurntSushi/toml now supports canada.toml.
* Update latest benchmarks in README
---
README.md | 33 +++++++++++++++++----------------
ci.sh | 6 ++----
2 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/README.md b/README.md
index 4931d75..5089bb3 100644
--- a/README.md
+++ b/README.md
@@ -158,12 +158,12 @@ Execution time speedup compared to other Go TOML libraries:
| Benchmark | go-toml v1 | BurntSushi/toml |
- | Marshal/HugoFrontMatter | 2.0x | 2.0x |
- | Marshal/ReferenceFile/map | 1.8x | 2.0x |
- | Marshal/ReferenceFile/struct | 2.7x | 2.7x |
- | Unmarshal/HugoFrontMatter | 3.0x | 2.6x |
- | Unmarshal/ReferenceFile/map | 3.0x | 3.1x |
- | Unmarshal/ReferenceFile/struct | 5.9x | 6.6x |
+ | Marshal/HugoFrontMatter-2 | 1.9x | 1.9x |
+ | Marshal/ReferenceFile/map-2 | 1.7x | 1.9x |
+ | Marshal/ReferenceFile/struct-2 | 2.4x | 2.6x |
+ | Unmarshal/HugoFrontMatter-2 | 2.9x | 2.5x |
+ | Unmarshal/ReferenceFile/map-2 | 2.7x | 2.6x |
+ | Unmarshal/ReferenceFile/struct-2 | 4.8x | 5.1x |
See more
@@ -176,16 +176,17 @@ provided for completeness.
| Benchmark | go-toml v1 | BurntSushi/toml |
- | Marshal/SimpleDocument/map | 1.7x | 2.1x |
- | Marshal/SimpleDocument/struct | 2.6x | 2.9x |
- | Unmarshal/SimpleDocument/map | 4.1x | 2.9x |
- | Unmarshal/SimpleDocument/struct | 6.3x | 4.1x |
- | UnmarshalDataset/example | 3.5x | 2.4x |
- | UnmarshalDataset/code | 2.2x | 2.8x |
- | UnmarshalDataset/twitter | 2.8x | 2.1x |
- | UnmarshalDataset/citm_catalog | 2.3x | 1.5x |
- | UnmarshalDataset/config | 4.2x | 3.2x |
- | [Geo mean] | 3.0x | 2.7x |
+ | Marshal/SimpleDocument/map-2 | 1.7x | 2.1x |
+ | Marshal/SimpleDocument/struct-2 | 2.5x | 2.8x |
+ | Unmarshal/SimpleDocument/map-2 | 4.1x | 3.1x |
+ | Unmarshal/SimpleDocument/struct-2 | 6.4x | 4.3x |
+ | UnmarshalDataset/example-2 | 3.4x | 3.2x |
+ | UnmarshalDataset/code-2 | 2.2x | 2.5x |
+ | UnmarshalDataset/twitter-2 | 2.8x | 2.7x |
+ | UnmarshalDataset/citm_catalog-2 | 2.2x | 2.0x |
+ | UnmarshalDataset/canada-2 | 1.8x | 1.4x |
+ | UnmarshalDataset/config-2 | 4.4x | 2.9x |
+ | [Geo mean] | 2.8x | 2.6x |
This table can be generated with ./ci.sh benchmark -a -html.
diff --git a/ci.sh b/ci.sh
index 3918f53..a617bc0 100755
--- a/ci.sh
+++ b/ci.sh
@@ -140,12 +140,10 @@ bench() {
if [ "${replace}" != "" ]; then
find ./benchmark/ -iname '*.go' -exec sed -i -E "s|github.com/pelletier/go-toml/v2|${replace}|g" {} \;
go get "${replace}"
- # hack: remove canada.toml.gz because it is not supported by
- # burntsushi, and replace is only used for benchmark -a
- rm -f benchmark/testdata/canada.toml.gz
fi
- go test -bench=. -count=10 ./... | tee "${out}"
+ export GOMAXPROCS=2
+ nice -n -19 taskset --cpu-list 0,1 go test '-bench=^Benchmark(Un)?[mM]arshal' -count=5 -run=Nothing ./... | tee "${out}"
popd
if [ "${branch}" != "HEAD" ]; then