4 ms·
> You are looking in the wrong place. Well, I randomly went and opened the C# binary tree example. I see a TreeNode struct with a private Next class inside of
by sirwhinesalot 5y ago
> You are looking in the wrong place.
Well, I randomly went and opened the C# binary tree example. I see a TreeNode struct with a private Next class inside of it. Can't think of any reason to write a BinaryTree like that in C# beyond trying to game some benchmarks.
The C++ implementation uses a node pool from the Apache Portable Runtime (a C library). Also not idiomatic (how did they get away with using a library?!). I particularly love how it doesn't even use std::string to write text to.
The Swift implementation also uses the Apache Portable Runtime node pool, completely non-idiomatic (even less justifiable than the C++ one), don't need to go into detail on this one.
The Go and Java implementations look perfectly normal for the respective languages.
The Dart one too, but that one doesn't even use any concurrency so it's starting from a losing position.
This is not a fair comparison.
- igouy 5y ago> … beyond trying to game some benchmarks… Did it work? If it wasn't massively more performant than other ways to write that program in C#, then maybe it's just fine for the purposes of "Energy Efficiency across Programming Languages". > … but that one doesn't even use any concurrency… What is the relationship between multicore and energy efficiency? > This is not a fair comparison. The comparison is energy efficiency not elapsed seconds, yes?
- sirwhinesalot 5y agoComparing the energy efficiency of code that's not even doing the same thing is not a useful comparison. If you're running these benchmarks on a server that's always running full throttle then using more cores will use less power because the software finishes faster. If you're running on a laptop the relationship between core usage, elapsed seconds, and power usage is very non-linear.