From: Kyle Katarn <kylekatar...@gmail.com> 
Sent: Friday, August 22, 2025 11:02 AM
To: Christoph M. Becker <cmbecke...@gmx.de>
Cc: Tim Düsterhus <t...@bastelstu.be>; PHP Internals <internals@lists.php.net>
Subject: Re: [PHP-DEV] [RFC] Add clamp function

> I created https://wiki.php.net/rfc/clamp_v2 (re-using most of the info from 
> https://wiki.php.net/rfc/clamp).

Hey,

 

I’m not against adding such a function, but I noticed that the RFC says

 

> some of which use min <https://www.php.net/manual/en/function.min.php>  and 
> max <https://www.php.net/manual/en/function.max.php>  to check the bound, 
> which is costly and slow when called often

 

What makes them slow? If we can create a significantly faster `clamp`, can we 
use the same optimizations to improve min and max?

 

BR,

Juris

Reply via email to