History log of /php-src/ext/mbstring/tests/mb_trim.phpt (Results 1 – 2 of 2)
Revision Date Author Comments
# 803cd824 28-Nov-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Optimizations for mb_trim (#12803)

* Fast path for when there is nothing to trim in mb_trim

* Make mb_trim decide between linear search vs hash table lookup

Using empirical

Optimizations for mb_trim (#12803)

* Fast path for when there is nothing to trim in mb_trim

* Make mb_trim decide between linear search vs hash table lookup

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.

show more ...


# a80b6d7b 30-Sep-2023 Yuya Hamada

Add mb_trim function

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Gina Peter Banyard <girgias@php.net>