TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Comparing JVM Virtual Threads vs. Real Threads in Clojure

6 pointsby bryanmikaelian10 months ago
I wrote this just to compare the performance of Java 21 Virtual Threads vs old-fashioned Threads.

1 comment

p-himik10 months ago
A couple of issues:<p>- The code ends up using reflection. Try `(set! *warn-on-reflection* true)` to see the warnings so you can fix them<p>- The vthreads code starts time measurement, then creates and starts the threads, then joins, then ends the measurement. But the rthreads code first creates the threads, then starts the measurement, then starts the threads, then never joins. You end up comparing apples to oranges<p>The results on my machine, after the fixes:<p><pre><code> virtual elapsed time (ms): 90 real elapsed time (ms): 45 </code></pre> Of course, it&#x27;s still a microbenchmark and as such shouldn&#x27;t be taken seriously for anything but hypothesis generation.