Originally reported by @Ori via [[https://gerrit.wikimedia.org/r/#/c/238668/|a gerrit patch]].
The use of DateTime::createFromFormat to create timestamps with microsecond resolution can incur milliseconds of runtime overhead when handling a request which generates a significant number of logging events. This cost is paid even if the events are eventually discarded as the $record['datetime'] member for each event is populated even if no handlers are interested in recording the event durably.
This simplistic benchmark shows the relative costs of collecting microsecond level timing data:
```
<?php
$limit = 1000;
$tz = new DateTimeZone('UTC');
$start = microtime(true);
for ($i = 0; $i < $limit; $i++) {
$dt = DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), $tz)->
setTimezone($tz);
}
echo 'createFromFormat: ', microtime(true) - $start, "\n";
$start = microtime(true);
for ($i = 0; $i < $limit; $i++) {
$dt = new DateTime(null, $tz);
}
echo 'DateTime: ', microtime(true) - $start, "\n";
```
```
$ php benchmark.php
createFromFormat: 0.010702133178711
DateTime: 0.0037209987640381
```
Reported upstream as https://github.com/Seldaek/monolog/issues/657 with a proposed fix provided in https://github.com/Seldaek/monolog/pull/658