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
    P

    Piotr Kołaczkowski

    pkolaczk.github.io · Personal blog · on HN since 2020

    Piotr Kołaczkowski, a Cassandra and Rust developer, writes about performance benchmarks, concurrency, memory use and disk I/O in Rust and Java.

    Visit blogHN submissions
    Systems & PerformanceLanguages & CompilersProgramming
    What HN says

    HN commenters discuss his benchmarks and corrections on Arc overhead and Java memory use, and link his earlier async memory comparison and his latte benchmarking tool.

    Stats for nerds
    17HN people shared it
    17linked in comments
    852story points
    Apr 2025last shared
    2020people per year2025

    Top posts on HN

    1. 1
      A single line of code made a 24-core server slower than a laptop
      6 people · 620 points · first shared 2021 · 195 comments on HN
    2. 2
      Overhead of Returning Optional Values in Java and Rust
      5 people · 91 points · first shared 2021 · 93 comments on HN
    3. 3
      In Defense of a Switch
      1 person · 56 points · first shared 2020 · 46 comments on HN
    4. 4
      Ordering Requests to Accelerate Disk I/O
      2 people · 46 points · first shared 2021 · 29 comments on HN
    5. 5
      Performance Impact of Parallel Disk Access
      1 person · 11 points · first shared 2020 · Discussion on HN
    6. 6
      Don't Share Java FileChannels
      1 person · 11 points · first shared 2023 · 1 comments on HN
    7. 7
      How Much Memory Do You Need to Run 1M Concurrent Tasks? (2023)
      5 people · 4 points · first shared 2023 · 2 comments on HN
    8. 8
      Multiple Thread Pools in Rust
      2 people · 4 points · first shared 2020 · Discussion on HN
    9. 9
      How a Single Line of Code Made a 24-Core Server Slower Than a Laptop
      1 person · 4 points · first shared 2021 · 7 comments on HN
    10. 10
      Benchmarking Apache Cassandra with Rust
      2 people · 2 points · first shared 2020 · Discussion on HN

    What HN people wrote when they linked it

    • marginalia_nuMay 2022

      > Does https://github.com/pkolaczk/latte count?

      This is just Rust code. Where is the equivalent Java code?

      Like the 50x-100x memory consumption is highly suspicious. If Java uses 50x the memory consumption compare to C++, how come I can allocate a long[SINT_MAX-10] on a system machine with 32 Gb of RAM? Shouldn't the process require of order 0.8 Tb of RAM if this statement is correct? Or can C++ allocate a 2 bn array of longs in 40 Mb of RAM? If so let me know, I would be very interested in using this novel compression technology.

      > Or the Optional cost described on my blog here: https://pkolaczk.github.io/overhead-of-optional/?

      Why aren't you using OptionalLong[1]? You shouldn't use Optional<Long>, that's never a good choice. At any rate, nobody should be claiming Java optionals are are free, they're a high level abstraction and absolutely do not belong in hot codepaths.

      In general it's fairly easy to construct benchmarks that favor any particular language, which is why you constantly see these blog posts about how high level interpreted languages (JS, PHP, Haskell) are faster than C++.

      You can easily construct "comparisons" that make JVM languages look superior to C++ as well, just carelessly allocate throwaway objects of different sizes and lifetimes (like you can in Java), oh no, why is C++ slowing down? Surely there's no heap fragmentation! That's a bad faith benchmark though. It doesn't really demonstrate anything other than that C++ following Java idioms isn't…

    • masklinnNov 2024

      > Thanks for the answer. But is this actual behaviour for the GCs of the JDK? I was certain that at the very least Hotspot makes use of stack allocation as much as possible.

      Not really, java has some escape analysis but it's very limited in its ability to stack allocate as it can't put entire structures (objects) on the stack, it only works if the compiler manages to scalar-replace the object (https://shipilev.net/jvm/anatomy-quarks/18-scalar-replacement/) and that has somewhat restricted applicability (https://pkolaczk.github.io/overhead-of-optional/). The behaviour I'm talking about is mostly that of Go, as it is much more capable of stack allocating, and specifically has a non-generational GC because in testing they found generational GCs had a very variable impact depending on workload (rather than a universally or near universally positive impact).

    • nyanpasu64Nov 2022

      Would an atomic mutable subclass cache (not sure what it's used for, downcasting?) be unnecessary in a language built around static rather than dynamic dispatch by default, like C/C++/Rust and perhaps Go? Or would it still speed up dynamically dispatched code, but is less practical or worthwhile so it isn't used in practice? (Though Rust's Arc also suffers from atomic contention similar to this blog post, when used across dozens of threads: https://pkolaczk.github.io/server-slower-than-a-laptop/)

      Also it's somewhat ironic that the JVM source code (https://github.com/openjdk/jdk8u/blob/jdk8u352-b07/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp#L5093) says "This code is rarely used, so simplicity is a virtue here" at the site of a bottleneck.

    • haulethJun 2023

      It is in the original article [1], though I was made aware that Go implementation is also incorrect as `defer` in it make the memory usage to substantially raise. So instead of:

      defer wg.Done()
      time.Sleep(10 * time.Second)

      In original article it should be:

      time.Sleep(10 * time.Second)
      wg.Done()

      And memory usage will drop about 2x. I am no Go nor Java developer so I cannot say anything more.

      [1]: https://pkolaczk.github.io/memory-consumption-of-async/

    • fulafelNov 2024

      On Linux, 400k threads was a thing on even on 2002 hardware that was 32-bit and thus limited to 4GB: https://news.ycombinator.com/item?id=37621887

      In the titular post there's a link to a previous comparison between approaches, and plain OS threads used from Rust fare quite well, even if the author doesn't up the OS limits to keep that in the running for the higher thread cases: https://pkolaczk.github.io/memory-consumption-of-async/

    • delifueApr 2025

      The "if I then go and code in Python, Java or C#, pretty much all objects have the overhead of an Arc" is not accurate. Rust Arc involves atomic operation and its preformance can greatly degrade when the reference count is being mutated by many threads. See https://pkolaczk.github.io/server-slower-than-a-laptop/

      Java, C# and Go don't use atomic reference counting and don't have such overhead.

    Related

    Cliff Bifflecliffle.com81 people

    Rewriting m4vgalib in Rust

    Cliff Biffle
    Personal · last shared 2026
    StalkRblog.stalkr.net24 people

    Golang heap corruption during garbage collection

    StalkR
    Personal · last shared 2025
    Shuttle Blogshuttle.rs34 people

    Infrastructure From Code

    Shuttle Blog
    Company · last shared 2024
    Gunnar Morlingmorling.dev56 people

    The One Billion Row Challenge

    Gunnar Morling
    Personal · last shared 2026
    Philipp Oppermannos.phil-opp.com95 people

    Learn Rust by writing a small OS

    Philipp Oppermann
    Personal · last shared 2026
    Micah Lernermicahlerner.com22 people

    Understanding Google’s File System (2020)

    Micah Lerner
    Personal · last shared 2025
    ScyllaDB Blogscylladb.com167 people

    How io_uring and eBPF Will Revolutionize Programming in Linux

    ScyllaDB Blog
    Company · last shared 2026
    Frank McSherryfrankmcsherry.org56 people

    Scalability, but at what cost? (2015)

    Frank McSherry
    Personal · last shared 2026