summaryrefslogtreecommitdiffstats
path: root/vendor/tinyvec/compare_benchmarks.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/tinyvec/compare_benchmarks.py
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/tinyvec/compare_benchmarks.py')
-rw-r--r--vendor/tinyvec/compare_benchmarks.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/tinyvec/compare_benchmarks.py b/vendor/tinyvec/compare_benchmarks.py
new file mode 100644
index 000000000..86eb7e862
--- /dev/null
+++ b/vendor/tinyvec/compare_benchmarks.py
@@ -0,0 +1,30 @@
+import os
+import os.path
+import json
+
+comparisons = []
+
+for (root, _dirs, files) in os.walk('target/criterion'):
+ for file in files:
+ if file == 'estimates.json' and root.endswith(
+ 'new') and 'TinyVec' in root:
+ path = os.path.join(root, file)
+
+ bench_name = path.split('/')[3]
+ tinyvec_time = json.load(open(path))['mean']['point_estimate']
+
+ path = path.replace('TinyVec', 'SmallVec')
+
+ smallvec_time = json.load(open(path))['mean']['point_estimate']
+
+ comparisons.append((bench_name, tinyvec_time / smallvec_time))
+
+comparisons.sort(key=lambda x: x[1])
+longest_name = max(len(c[0]) for c in comparisons)
+for (name, ratio) in comparisons:
+ # Undo the criterion name mangling
+ name = name.replace('_[', '<[')
+ name = name.replace(']___', ']>::')
+
+ name = name.ljust(longest_name)
+ print(f"{name} {ratio:.2f}")