This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aleph (1)
- # announcements (2)
- # beginners (109)
- # calva (48)
- # cider (25)
- # clj-kondo (38)
- # cljdoc (13)
- # clojure (203)
- # clojure-europe (23)
- # clojure-gamedev (3)
- # clojure-nl (3)
- # clojure-uk (7)
- # conjure (2)
- # data-science (1)
- # datalog (2)
- # datomic (7)
- # deps-new (16)
- # depstar (2)
- # docker (2)
- # fulcro (67)
- # graalvm (58)
- # honeysql (16)
- # java (2)
- # jobs (2)
- # jobs-discuss (2)
- # kaocha (4)
- # lsp (82)
- # malli (23)
- # off-topic (35)
- # polylith (18)
- # practicalli (5)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (15)
- # sql (17)
- # timbre (1)
- # tools-deps (24)
- # vim (20)
- # xtdb (9)
Are there any performance benchmarks that compare Clojure to other Lisps? Shockingly haven't found any.
I'm not surprised you haven't found any (or were you being sarcastic, perhaps?).
Nope, legitimately; All my google-fu has led me to is a lot of conjecture on places like HN.
I'd be more surprised if you found any performance benchmarks comparing Lisps to other languages. There are benchmarks across multiple implementations of Common Lisp, but they all use the same benchmark suite (written in Lisp).
You'd also really be comparing apples to oranges unless you can find common applications that act as benchmarks between Lisp implementations and other languages -- which I think is why it's hard to find such things.
With mainstream/modern languages, there are quite a few "standard" benchmarks out there that people have implemented in a wide range of languages (and then heavily tuned the code so it's no longer idiomatic, quite often!).
Well there's the classic (and arguably classically flawed) Debian hosted "Benchmark Game" https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/racket.html -- but to my knowledge it doesn't have a clojure page anymore (pretty sure it did at somepoint iirc)
But yeah, I agree it's hard to get a fair-enough benchmark between languages (even Lisps) with such a different execution model, immutable / mutable state at it's core, level of abstraction, etc.
My (uniformed) intuition would be that SBCL & Clojure a'la the JVM would be within a magnitude or-so of eachother -- but no idea how close / off that intuition may be. lol
i've heard sbcl can get seriously fast with types added in. no idea what it would be like to work on a codebase like that though
You can do things like https://graphql.gklijs.tech/results/graphql-servers-feb/average-ge-mem but it will be very specific to the libraries used, and just for that specific problem.
And someone revisting these: https://renato.athaydes.com/posts/revisiting-prechelt-paper-comparing-languages.html
Compare Java to other lisps, those you can find Clojure can be as fast as Java with enough black magic, so that's your upper bound Should be a good enough ballpark
SBCL can reach optimized C++ speeds when all the right type declarations are used, though if the C++ compiler is outputting SIMD instructions it’ll probably win by a factor of 4 or more, since I don’t think SBCL supports optimizing code to use those yet. That said, you can also use inline assembly in SBCL (by defining virtual operations, “vop”s), so you can manually utilize SIMD if you want to reach those speeds too. I’m not aware of any way to reach that level of performance on the JVM.
clojure that performs as well as java is usually just bad obfuscated java btw, I highly recommend rewriting code in perf bottle necks in java (especially for numerics)
Yeah, I guess I'm somefactor asking about "idiomatic Clojure" and not* Java-with-parens lol
related (this is already off-topic so why not) today I rewrote a clojure utility in c, I gave up on one fancy feature and no longer do command line parsing, and it resulted in a smaller and simpler c program compared to the original clojure lol http://ix.io/3vcW http://ix.io/3vcV
(it's a ranked preference random video game character chooser for when I'm not sure what character to play next)
That's actually pretty relevant -- in that I want to get into gamedev a bit at somepoint; Well more-aptly learn about how these things work and was loosely planning somefactor of an 'engine' ... and that's kinda a fear of considering Clojure in-that I'm worried it'll be prohibitive
Looks like basically using Clojure as a scripting-language a'la Arcadia on Unity / Godot and/or wrapping JmonkeyEngine is often 'good enough' but trying to implement "everything" (ie: not just game-logic*) in idiomatic Clojure ... basically everything on-top of LWJGL seems like it'd be at best "more of a challenge" and at-worst not-workable
one implementation uses maps, sorting, laziness, the other is linear and straightforward. If you reimplement the c program in clojure you'll get something new
C doesn't let you do a lot so you keep it simple. I sometimes see lots of fancy and complicated data transformations in clojure because it's easy to do
Clojure written with performance in mind can still be idiomatic, but looks very different