Re: str_repeat performance
| From: | Christoph M. Becker | Date: | Sat, 10 Sep 2022 12:23:18 +0000 |
| Subject: | Re: str_repeat performance | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118597@lists.php.net to get a copy of this message | ||
On 10.09.2022 at 14:19, Eugene Sidelnyk wrote:
> I have noted some strange points about
str_repeat performance.
> It looks
> like the lesser $times argument is, the bigger is execution
> time (only if
> we consider big numbers).
>
> For example, str_repeat('%d ', 12500); is a lot
> slower than
> str_repeat('%d ', 1250000).
>
> First case (slow one):
> https://3v4l.org/ZAoGi
>
> Second case (fast one):
> https://3v4l.org/YIdQM
It seems you have misinterpreted the results. 4.792213439941406E-5 is
certainly much smaller than 0.013129949569702148, for instance.
--
Christoph M. Becker