[php-src] PR #25718: date: Skip timelib parsing in strtotime() for "now"
| From: | adapik | Date: | Tue, 24 Nov 2026 19:28:46 +0000 |
| Subject: | [php-src] PR #25718: date: Skip timelib parsing in strtotime() for "now" | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40974@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25718
Author: adapik
While working on #25702, I noticed that
strtotime() behaves the same way. For
"now" the parsed result is an empty timelib_time, and timelib_fill_holes() copies
everything from the base time. The final timestamp is therefore just the base timestamp
($baseTimestamp, or the current time when it is omitted). Still,
strtotime("now") scans the string, allocates a timelib_time, fills holes and
runs timelib_update_ts(), and then returns the value it started with.
Release build, ns per call (median of 7 runs):
| Call | master | patched | Change |
|---|---:|---:|---:|
| strtotime("now") | 187.8 | 36.3 | −81% |