Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    J

    Jean Niklas L'orange

    blog.higher-order.net · Personal blog · on HN since 2008

    Jean Niklas L'orange writes on Clojure internals, including persistent vectors, hash maps, protocols, and event sourcing.

    Visit blogHN submissions
    Languages & CompilersProgramming
    What HN says

    Commenters repeatedly link his persistent vector post as a good explanation of Clojure's tree-of-arrays implementation, plus the companion hash map piece.

    Stats for nerds
    15HN people shared it
    12linked in comments
    229story points
    May 2013last shared
    2010people per year2013

    Top posts on HN

    1. 1
      Understanding Clojure's PersistentVector implementation (2009)
      1 person · 109 points · first shared 2016 · 1 comments on HN
    2. 2
      Understanding Clojure’s PersistentVector implementation
      6 people · 46 points · first shared 2009 · 1 comments on HN
    3. 3
      Understanding Clojure’s PersistentHashMap
      3 people · 42 points · first shared 2009 · Discussion on HN
    4. 4
      Clojure Circuit Breaker
      1 person · 15 points · first shared 2009 · Discussion on HN
    5. 5
      Circuit Breaker: a small but real-life example of Clojure protocols and datatype
      1 person · 5 points · first shared 2010 · Discussion on HN
    6. 6
      Clojure event sourcing
      1 person · 4 points · first shared 2009 · Discussion on HN
    7. 7
      Assoc and Clojure’s PersistentHashMap: part ii
      1 person · 3 points · first shared 2010 · Discussion on HN
    8. 8
      Clj-ds: Clojure’s persistent data structures for Java
      1 person · 2 points · first shared 2010 · Discussion on HN
    9. 9
      Annotated Clojure links - part 1
      1 person · 2 points · first shared 2008 · Discussion on HN
    10. 10
      Jeene: An automatic partial evaluator for JavaScript
      1 person · 1 points · first shared 2008 · Discussion on HN

    What HN people wrote when they linked it

    • aphyrMay 2013

      On a related note, cache alignment is one of the reasons Clojure's vectors (log32 insertion, access, and deletion) and linked lists (o(index) insertion, access, and deletion) have unintuitive performance characteristics. For instance, constructing lists of either type takes roughly the same amount of time for big lists:

      user=> (with-progress-reporting (bench (into '() (range 100000))))
      Execution time mean : 9.293932 ms
      Execution time std-deviation : 269.771284 µs

      user=> (with-progress-reporting (bench (into [] (range 100000))))
      Execution time mean : 9.882163 ms
      Execution time std-deviation : 359.744662 µs

      And with smaller lists, building vectors is ~30-50% slower.

      user=> (with-progress-reporting (bench (into '() (range 24))))
      Execution time mean : 2.483705 µs
      Execution time std-deviation : 71.302962 ns

      user=> (with-progress-reporting (bench (into [] (range 24))))
      Execution time mean : 3.349080 µs
      Execution time std-deviation : 114.007930 ns

      However, traversal is significantly faster for vectors, because you can pack 32 references into a cache line at a time. Here's a decent-sized list:

      user=> (let [x (apply list (range 100000))] (bench (reduce + x)))
      Execution time mean : 8.586510 ms
      Execution time std-deviation : 80.923357 µs

      Vs a comparable vector:

      user=> (let [x (vec (range 100000))] (bench (reduce + x)))
      Execution time mean :…

    • brehautJan 2010

      The top level index is a clojure map (a persistent hash-map by default i believe) of strings (stems) to another map of key to weighting. The hash-map is implemented as a Bagwell Trie under the hood. Check out http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/ for a lot of detail on the implementation, and http://en.wikipedia.org/wiki/Trie for a general overview of how Tries differ from Trees.

    • shadytreesMay 2010

      There's also a companion piece on PersistentHashMap based also on the idea of chunky bits:
      http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/

    • jefffosterFeb 2010

      There's a good overview of how persistent vectors are implemented in Clojure here - http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/

    • krosaenApr 2012

      Another approach: use a persistent data structure ala clojure's:

      http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation

    • jacquesmMay 2010

      I found a link to the implementation details, you are correct:

      http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/

    Related

    Andrew Brehautbrehaut.net18 people

    A Brief Overview of the Clojure Web Stack

    Andrew Brehaut
    Personal · last shared 2013
    Rigsomelightrigsomelight.com16 people

    The Frameless Geodesic Dome I currently live in

    Rigsomelight
    Personal · last shared 2025
    Probably Danceprobablydance.com74 people

    Fibonacci Hashing: The Optimization That the World Forgot

    Probably Dance
    Personal · last shared 2026
    Yogthosyogthos.net45 people

    Why I'm Productive in Clojure (2013)

    Yogthos
    Personal · last shared 2026
    Alex Millerinsideclojure.org19 people

    Clojure 1.11 planning

    Alex Miller
    Personal · last shared 2024
    Valentin Waeselynckvvvvalvalval.github.io29 people

    What makes a good REPL?

    Valentin Waeselynck
    Personal · last shared 2025
    LispCastlispcast.com108 people

    React: Another Level of Indirection

    LispCast
    Personal · last shared 2022
    Best In Classbestinclass.dk46 people

    Reddit/HN clone in Clojure

    Best In Class
    Personal · last shared 2020