Re:Rust is now overall faster than C in benchmarks
by jeltz on Monday January 04, 2021 @02:34AM
(#25628639)
Heavy use of linked lists is one reason for why commercial C code often is slow. While there are some exceptions linked lists are slower than arrays for most things. Linked lists are easy to implement in C and therefore used a lot.
Re:Rust is now overall faster than C in benchmarks
by wink on Sunday January 03, 2021 @07:44PM
(#25626780)
You can't really compare C with a C++ stdlib or boost, or Qt. Well, some organizations surely have their own repo of debugged, tested, and optimized stuff but I guess a lot of them roll everything on their own again and again - and in C++ there is a rich ecosystem, at least for basic data structures.
Re:Rust is now overall faster than C in benchmarks
by RcouF1uZ4gsC on Sunday January 03, 2021 @09:28PM
(#25627384)
The other thing that C++ and Rust have for collections and algorithms is that they follow a standard pattern.
Because of that, it is usually pretty easy to substitute an optimized algorithm or a container for another one with minimal code changes. In C, because there is no standard for how to do containers and algorithms, it is likely that every library does something a little different in terms of conventions making it harder to swap in implementations.
Re:Rust is now overall faster than C in benchmarks
by Skunkleton on Sunday January 03, 2021 @11:59PM
(#25628056)
> I would’ve thought most commercial C programs would have heavily used linked lists, hashes (dictionary), and binary search trees all over the place.
Every large scale C code base I have worked on has had these things, and they were used as you say all over the place. If I were to encounter a code base that didn't have these things I would wonder why it was written in C in the first place.
Re:Rust is now overall faster than C in benchmarks
by Leherenn on Monday January 04, 2021 @11:56AM
(#25634022)
Conversely, I have only seen arrays being used, and never linked lists/hash maps in the few embedded code bases I have worked on.
Re:Rust is now overall faster than C in benchmarks
by greyhair on Monday January 04, 2021 @06:32PM
(#25639765)
And I have run across, and implemented, both linked lists, and arrays, in embedded systems. The implementation depended on what made the most sense for the particular problem being addressed.
I assume most C++ programs heavily use more of these advanced data structures, correct?