summaryrefslogtreecommitdiff
path: root/benchmarks/benchmark.py
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2025-08-05 10:37:58 +0200
committerPeter Bex <peter@more-magic.net>2025-08-18 13:39:32 +0200
commit12a4f8e2415a767c501898d3626663f78fb3c33d (patch)
tree3e4aaad53cf2198109b2eb1a2fa6fefe8b09602f /benchmarks/benchmark.py
parent565171c7b0a7389e60ec6f8593732988f43b6aef (diff)
downloadslset-12a4f8e2415a767c501898d3626663f78fb3c33d.tar.gz
Add benchmarks for Ruby, Python and Clojure
Ruby is about the same speed as slets. Clojure (babashka) and Python are goddamn fast. Python is 10 times as fast. Clojure is twice as slow as Python but that still outperforms Ruby and slsets.
Diffstat (limited to 'benchmarks/benchmark.py')
-rw-r--r--benchmarks/benchmark.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/benchmarks/benchmark.py b/benchmarks/benchmark.py
new file mode 100644
index 0000000..eae0e7c
--- /dev/null
+++ b/benchmarks/benchmark.py
@@ -0,0 +1,10 @@
+import sys
+
+size = int(sys.argv[1])
+
+myset1 = {f"x{i*1000}" for i in range(0, size)}
+myset2 = {f"x{i*1000+1}" for i in range(0, size)}
+
+res = None
+for i in range(0, 10000):
+ res = myset1 - myset2