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.

What HN saysHN 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.
17HN people shared it
11linked it in comments
17stories submitted
852story points
8 months agolast shared
2020people per year2026

Most-shared posts

  1. 1
  2. 2
    Overhead of Returning Optional Values in Java and Rust
    5 people · 91 points · first shared 2021 · 93 comments on HN
  3. 3
    How Much Memory Do You Need to Run 1M Concurrent Tasks?
    5 people · 4 points · first shared 2023 · 2 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
    Multiple Scoped Thread Pools in Rust
    2 people · 4 points · first shared 2020 · discussion on HN
  6. 6
    Benchmarking Apache Cassandra with Rust
    2 people · 2 points · first shared 2020 · discussion on HN
  7. 7
    In Defense of a Switch
    1 people · 56 points · first shared 2020 · 46 comments on HN
  8. 8
    Don't Share Java FileChannels
    1 people · 11 points · first shared 2023 · 1 comments on HN
  9. 9
    Performance Impact of Parallel Disk Access
    1 people · 11 points · first shared 2020 · discussion on HN
  10. 10
  11. 11
    Estimating Benchmark Results Uncertainty
    1 people · 2 points · first shared 2020 · discussion on HN
  12. 12
    Scalable Benchmarking with Rust Streams
    1 people · 1 points · first shared 2020 · discussion on HN
  13. 13
    Homepage
    1 people · first shared 2020

What HN people wrote when they linked it

delifue · 2025-04-30
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.
nyanpasu64 · 2022-11-11
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… says "This code is rarely used, so simplicity is a virtue here" at the site of a bottleneck.
pkolaczk · 2020-09-19
My personal blog site scored only 20 and the AI said the layout was too complex, although the layout is quite minimalistic :( https://pkolaczk.github.io/
marginalia_nu · 2022-05-23
> 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…
codetiger · 2024-11-29
The original benchmark had the comparison between Java thread and Java Virtual thread. https://pkolaczk.github.io/memory-consumption-of-async/
fulafel · 2024-11-29
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/
masklinn · 2024-11-25
> 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).
hauleth · 2023-06-11
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/
bitcoinmaxima · 2021-12-31
sbt567 · 2021-04-05
Blog post[1] on what makes fclones really fast [1] https://pkolaczk.github.io/disk-access-ordering/

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close