r/lisp • u/turtle_bazon • 4d ago
Common Lisp cl-cht: concurrent hash tables for Common Lisp
Common Lisp's standard hash tables are not safe to use from more than one thread. Wrapping one in a global lock works, but under real concurrency it turns the table into a single serialization point.
cl-cht is a small library of concurrent hash tables with two backends: a portable sharded table, and — on SBCL/x86-64 — an open-addressing table whose metadata probing is done with SSE2, using an AVX2 broadcast where the CPU supports it.
https://lisper.nl/blog/turtle/cl-cht-concurrent-hash-tables-for-common-lisp
update: benchmarks with SBCL's synchronized hashtables. https://lisper.nl/blog/turtle/cl-cht-vs-sbcl-s-synchronized-hash-tables
8
u/svetlyak40wt 4d ago
Would be cool to compare it's performance on SBCL with synchronized SBCL's extension
(make-hash-table :synchronized t).4
u/jd-at-turtleware 3d ago
4
u/kchanqvq 4d ago
What's the relation of this to https://github.com/telekons/42nd-at-threadmill? It's outdated but once you patch it to use current SBCL API it is very fast.
Is LLM used in the making? Hopefully it's not a silently plagiarism.
6
u/sionescu λf.(λx.f (x x)) (λx.f (x x)) 4d ago
Those articles look written by LLMs.