Performance optimization for minElement and maxElement

Ali Çehreli acehreli at yahoo.com
Mon Sep 12 11:46:23 UTC 2022


On 9/12/22 04:07, H. S. Teoh wrote:
 > On Sun, Sep 11, 2022 at 07:40:35PM -0700, Ali Çehreli via 
Digitalmars-d wrote:
 >> Since the minimum and maximum values of fundamental types are known, can
 >> minElement and maxElement shortcut and return that value immediately?
 >
 > No, because that value may not appear in the given range.
 >
 >
 > T

I am not that silly. :) What I meant is "as soon as they see e.g. 0". 
Say, at the third element of a million-element range...

Ali



More information about the Digitalmars-d mailing list