Performance optimization for minElement and maxElement
Per Nordlöw
per.nordlow at gmail.com
Mon Sep 12 21:08:32 UTC 2022
On Monday, 12 September 2022 at 02:40:35 UTC, Ali Çehreli wrote:
> Since the minimum and maximum values of fundamental types are
> known, can minElement and maxElement shortcut and return that
> value immediately?
I would take a peek a look the standard libraries of C++ and Rust
see if they apply this optimization trick.
The real question is what input the algorithm should be optimized
for. And how big of an overhead such a check has in the case
where early return never happens.
More information about the Digitalmars-d
mailing list