News for hackers. Stuff that matters.
Re:Should Small Rust Structs be Passed by-copy or by-borrow? by imron on Saturday December 31, 2022 @03:54PM (#34200640)
Great. Should be easy to prove then.
Re:Should Small Rust Structs be Passed by-copy or by-borrow? by dahfizz on Saturday December 31, 2022 @04:19PM (#34200869)
Yup, we have a good benchmarking suite to make sure changes don't cause regressions and that optimization changes actually work.

That said, I think asking a developer to write everything they do twice so that they can A/B test is overboard. You can come back and really aggressively optimize later, but I think the "default" should be the fast thing, rather than the slow & easy thing.

Re:Should Small Rust Structs be Passed by-copy or by-borrow? by bmacho on Saturday December 31, 2022 @05:04PM (#34201237)
If "performance really does matter" (in Fintech) then a developer surely can write everything twice or more.
Re:Should Small Rust Structs be Passed by-copy or by-borrow? by dahfizz on Saturday December 31, 2022 @05:27PM (#34201397)
We could, yeah. I'm sure you're capable of re-writing everything you do twice. It's just a huge waste of time.

You get just as much benefit by assigning a performance refactor to an engineer when needed vs literally halving or worse the whole teams productivity.

Re:Should Small Rust Structs be Passed by-copy or by-borrow? by gpderetta on Saturday December 31, 2022 @06:34PM (#34201860)
Time to market can matter in fintech as much as anywhere else.

Edit: also optimizations often interact with each other and you can't always benchmark all possible combinations, so sometime you do have to rely on experience or reasoning from first principles to decide if an optimisation is worth it or not.

Re:Should Small Rust Structs be Passed by-copy or by-borrow? by elimerl on Saturday December 31, 2022 @05:18PM (#34201340)
The idea is that the "default" is the easy thing, which is usually optimized by the compiler.
Re:Should Small Rust Structs be Passed by-copy or by-borrow? by TillE on Saturday December 31, 2022 @07:12PM (#34202139)
When you're writing in a language like Rust or C++, you know broadly what the compiler optimizes and what it probably won't. You do need to do the work yourself a lot of the time.