4 ms·
I just went through all of this when building a raytracer. * Sprinkling & around everything in math expressions does make them ugly. Maybe rust needs an asBor
by Rustwerks 4y ago
I just went through all of this when building a raytracer.
* Sprinkling & around everything in math expressions does make them ugly. Maybe rust needs an asBorrow or similar?
* If you inline everything then the speed is the same.
* Link time optimizations are also an easy win.
https://github.com/mcallahan/lightray https://github.com/mcallahan/lightray
- masklinn 4y ago> * Sprinkling & around everything in math expressions does make them ugly. Maybe rust needs an asBorrow or similar? Do you mean AsRef, or do you mean magic which automatically borrows parameters and is specifically what rust does not do any more than e.g. C does? Though you can probably get both if the by-ref version is faster (or more convenient internally): wrap the by-ref function with a by-value wrapper which is #[inline]-ed, this way the interface is by value but the actual parameter passing is byref (as the value-consuming wrapper will be inlined and essentially removed).
- woodruffw 4y ago> Maybe rust needs an asBorrow or similar? FWIW, the `Borrow`, `AsRef`, and `Deref` traits all exist to support different variants of this.