Re:Should small Rust structs be passed by-copy or by-borrow?
by whatshisface on Monday August 26, 2019 @10:10AM
(#20799981)
>If you need fast number crunching use the specialised library for it, not by writing a magic for loop with just the right amount of statements in it.
There is always that group of people who are trying to do something for which no specialized library exists.
Re:Should small Rust structs be passed by-copy or by-borrow?
by 0xffff2 on Monday August 26, 2019 @04:14PM
(#20803281)
As a member of that group, Hacker News is not where I come for answers to my questions. I think it's perfectly reasonable for comments here to assume that the readers of the comment aren't in that group. Either you know what you're doing enough that 99.9% of the internet is not helpful to you, or you're probably up shit creek without a paddle anyway until you figure out enough to move into the first group.
Re:Should small Rust structs be passed by-copy or by-borrow?
by littlestymaar on Monday August 26, 2019 @12:29PM
(#20801161)
Then they'll use ASM, manual SIMD or pointers arithmetic like they would do in C and that would work. All of theses are part of the unsafe Rust (inline ASM is nightly only though, but you can still link to a ASM file even in stable).
If you need concise pointer control, use the unsafe trapdoor built into rust (like Rust's Vec). If you need very specialised code use assembly, not by abusing language side-effects like Duff's Device. If you need fast number crunching use the specialised library for it, not by writing a magic for loop with just the right amount of statements in it.
I admit that sometimes you need to micro-optimise, but I haven't come across this case much in my Rust code. When I do I usually hinder more then help it.