[php-src] PR #22722: perf: direct syscall fastpath for absolute paths in zend_virtual_cwd
| From: | henderkes | Date: | Tue, 14 Jul 2026 08:20:56 +0000 |
| Subject: | [php-src] PR #22722: perf: direct syscall fastpath for absolute paths in zend_virtual_cwd | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37033@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22722
Author: henderkes
Absolute paths don't need to go through the per-thread cwd emulation, add a fast-path to
directly hand them to libc.
since relative paths won't start with a leading slash, this adds negligible cost for them
```php
<?php
chdir(__DIR__);
$s = microtime(true);
for ($i = 0; $i < 1000000; $i++) {
file_exists("data.txt");
}
$rel = microtime(true) - $s;
$abs = __DIR__ . "/data.txt";
$s = microtime(true);
for ($i = 0; $i < 1000000; $i++) {
file_exists($abs);
}
$abs_t = microtime(true) - $s;
```
| workload | master | patch | delta |
|---|---|---|---|
| relative path | 0.3521s | 0.3524s | +0.09% |
| absolute path | 0.3162s | 0.2623s | −17.05% |