From 39f3ea56211d4b6904290dd2f257715c901c25bf Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Tue, 5 Aug 2025 10:37:58 +0200 Subject: 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. --- benchmarks/benchmark.clj | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 benchmarks/benchmark.clj (limited to 'benchmarks/benchmark.clj') diff --git a/benchmarks/benchmark.clj b/benchmarks/benchmark.clj new file mode 100644 index 0000000..96ca968 --- /dev/null +++ b/benchmarks/benchmark.clj @@ -0,0 +1,11 @@ +;; Run as e.g. "bb benchmark.clj 1000" +(ns benchmark + (:require [clojure.set :as set])) + +(def size (Integer/parseInt (first *command-line-args*))) + +(def set1 (set (map (fn [i] (keyword (str "x" i))) (range size)))) +(def set2 (set (map (fn [i] (keyword (str "y" i))) (range size)))) + +(doseq [x (range 10000)] + (set/difference set1 set2)) -- cgit v1.2.3