[php-src] PR #12803: Optimizations for mb_trim

From: Date: Mon, 27 Nov 2023 20:40:52 +0000
Subject: [php-src] PR #12803: Optimizations for mb_trim
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-24343@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/12803 Author: nielsdos * [Fast path for when there is nothing to trim in mb_trim](https://github.com/php/php-src/commit/0aa7c3f6b28941f38af25cdbac8759a058c08c30) * [Make mb_trim decide between linear search vs hash table lookup](https://github.com/php/php-src/commit/0373eb8f8e43c645c0861e99b85c2765bd10b7f8) Using empirical experiments I noticed that on my i7-4790 the hash table approach becomes faster once we have more than 4 code points in the trim characters, when evaluated on the worst case. This patch changes the logic so that a hash table is used for a large number of trim characters, and linear search when the number of trim characters is <= 4. Benchmark script used: https://gist.github.com/nielsdos/518c0c667e17c7bf145e634bcd6c9716 cc @youkidearitai

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