[GIT-PULLS] [php-src] PR #22722: perf: direct syscall fastpath for absolute paths in zend_virtual_cwd

[email protected] (henderkes)
Newsgroups php.git-pulls
Message-ID <EAEg9X1J5gjlrKzjD5iQM8pPeyQyi35Fv40cVjWwLqA@main.internal.php.net>
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% |
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.