alamb commented on PR #6281: URL: https://github.com/apache/arrow-rs/pull/6281#issuecomment-2305170642
> @tustvold @alamb what is your philosophy when it comes to optimizations such as this, where unsafe code is used to gain some performance? I often find myself reaching for unsafe code to get a few more %, but wonder if that is generally frowned upon. In general my philosophy is that unsafe should only be used when: 1. It actually improves performance (as demonstrated by a benchmark) 2. It can be clearly explained why it is actually correct to use `unsafe` 3. The relative performance is "enough" to justify unsafe The last one is certainly a judgement call and has room for interpretation For inner loops that plausibly could show up in end to end system performance it seems reasonable For little used code paths or ones that are likely not performance critical it would be harder in my mind -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
