[php-src] PR #22975: zip: skip the entry name allocation when there is no add_path
| From: | iliaal | Date: | Fri, 31 Jul 2026 14:43:55 +0000 |
| Subject: | [php-src] PR #22975: zip: skip the entry name allocation when there is no add_path | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37416@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22975
Author: iliaal
php_zip_add_file() takes a char*/length pair, so without a prefix to
concatenate the entry name was allocated and released once per file only to pass one through. Hand
it file_stripped directly, and hold basename until after the call because
file_stripped can point into it.
Measured on 4000 files with addGlob(): 22.2/22.2/22.8 ms patched against 23.8/22.2/22.1
ms before, so the saving is under the noise of the expand_filepath() and
stat() the loop already does per entry. This is about the redundant work, not about a
number.
Same function as #22973, which is the correctness fix; this one only removes the allocation.