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-05 10:37:58 +0200
commit39f3ea56211d4b6904290dd2f257715c901c25bf (patch)
tree305f907657223817abf2d6576d5005f38057ec58 /benchmarks/benchmark.py
parentf2c8f8287fbc975eee1413f39709af8b43d358c2 (diff)
downloadslsets-39f3ea56211d4b6904290dd2f257715c901c25bf.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