[php-src] PR #23960: zend_alloc: use uint32_t for small bin numbers

From: Date: Mon, 28 Sep 2026 08:13:00 +0000
Subject: [php-src] PR #23960: zend_alloc: use uint32_t for small bin numbers
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-38874@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/23960 Author: marc-mabe zend_mm_alloc_small() and zend_mm_free_small() took the bin number as a signed int, while zend_mm_alloc_small_slow() and the other bin helpers take uint32_t. The bin number indexes bin_data_size[] several times per call, and with the signed type GCC failed to see that the indexes are the same, so it loaded bin_data_size[bin_num] twice on the emalloc() and efree() fast paths and more often in zend_mm_realloc_heap(). Take the bin number as uint32_t in both, return it as such from zend_mm_small_size_to_bin(), and declare old_bin_num in zend_mm_realloc_heap() accordingly. Benchmark result showed Symfony (39329182 -> 39235875) and WordPress (130213406 -> 129904538) - so -0.4% to -0.56% on arm64 (Ubuntu 24.04 VM/Container on Mac).

« previous php.git-pulls (#38874) next »