3 ms·
> … aren’t allowed to preallocate memory… Because as-you-know the whole point is to "allocate zillions of short-lived nodes" — https://news.ycombinator.com/it
by igouy 5y ago
> … aren’t allowed to preallocate memory…
Because as-you-know the whole point is to "allocate zillions of short-lived nodes" —
https://news.ycombinator.com/item?id=29323468 https://news.ycombinator.com/item?id=29323468
- deleted 5y ago[deleted]
- throwaway894345 5y ago“It’s not a bad benchmark, it’s just showcasing a contrived scenario with different sets of rules for different kinds of languages”. Most people aren't building applications whose business requirements preclude preallocating memory except for languages which lack garbage collectors.
- igouy 5y agoSo those are scare quotes not actually quotation? If we don't experience a performance problem, we don't need a workaround.
- throwaway894345 5y agoNo, that’s not an actual quotation. I was having a laugh at the silly logic which attempts to justify the benchmark. And preallocating isn’t a workaround, it’s idiomatic in Go.
- igouy 5y agoThat is not a contradiction: it can be both idiomatic in Go and a workaround to avoid garbage collection.
- throwaway894345 5y agoAnd that’s a valid point for the set of applications whose purpose is generating garbage. But overwhelmingly this isn’t interesting and people mistake this benchmark for a useful indicator of programming language performance in the general case.
- igouy 5y agoAnd the set of applications that will inevitably generate garbage, which might be left to automatic garbage collection. Errare humanum est. "Energy Efficiency across Programming Languages" not "programming language performance in the general case".
- throwaway894345 5y agoIt’s not a very compelling defense of a benchmark to argue that it measures something different for some languages than others—in this case for Go the benchmark measures poorly/carelessly written code while for other languages it measures meticulously optimized code. I maintain a contrived benchmark is not a useful benchmark.
- igouy 5y agoIn this case for Go, the same as other languages that provide automatic garbage collection. In this case for Go, the same as other languages that provide a library pool implementation. Apparently the study authors found a use.
- sirwhinesalot 5y agoThe C++ and Swift implementations use a node pool from the Apache Portable Runtime. This benchmark would be a lot more interesting if we got to see the price of C++'s RAII or Swift's reference counting. The Swift Code looks like something you'd write in C.
- igouy 5y agoYou could ask the authors to update their study. You could look at the different binary trees programs shown on the current benchmarks game.
- igouy 5y ago> … the price of C++'s RAII… Like this? (There are 8 other C++ binary trees programs.) https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/binarytrees-gpp-7.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... > … or Swift's reference counting. Like this? (There are 4 other Swift binary trees programs.) https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/binarytrees-swift-1.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...