4 ms·
The article is interesting, but it is frustrating that it mainly cares about speed, but 'speed' or 'fast' is not mentioned in the title. To answer that general
by beeforpork 7y ago
The article is interesting, but it is frustrating that it mainly cares about speed, but 'speed' or 'fast' is not mentioned in the title.
To answer that general title question, I would not even have considered that 'speed' might be an issue. I'd say: pass small things by value because it probably results in the most readable code, which should always be the first dimension of optimisation, I think. Also, the compiler is most probably good enough anyway, so care about your source code readability first.
So, at least the title should say 'if you care about speed a lot'.
- ncmncm 7y agoEveryone cares about speed first, or they would be using a more convenient slow language. The challenge of Rust is, how nice can we make a language without noticeably giving up any performance to C++? Pretty nice, it turns out. C++ still has an edge on both performance and ability to code powerful libraries that are not a PITA to use. The performance margin definitely will close up. The library margin could, too, but it will require unpleasant choices. Anyway both are faster than almost anything else, and will stay that way, for von Neumann machines. Those might get less important, soon.
- deleted 7y ago[deleted]
- bilkow 7y ago> Everyone cares about speed first, or they would be using a more convenient slow language. I use Rust and I actually care about readability first. Sincerely I find Rust more readable than most popular languages (Python, Javascript, C++, Java, even Swift...), unless I'm looking into some code that abuses generics and lifetimes (which is actually rare for me). I think that's because it enforces some pretty clear patterns with its lack of struct inheritance, sum types with pattern matching, the way things are imported ("use" statements), lack of parenthesis around conditionals, and being expression oriented.