-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rtrim
equal fast to preg_replace
#13710
Comments
Short answer: expressions like |
@staabm Your benchmarking is flawed. You're only doing a single call to rtrim vs preg_replace, so the execution time of that is drowned by the startup, parse+compile, and shutdown time of php. You need to do multiple loops. Furthermore, you're not testing on the latest development version (which does have performance improvements regarding function calls). When testing with a modified script:
and
I get that
|
thats great news, thank you for the details - I was hoping for such a result, but was not able to prove it in benchmarks :). |
Description
I am currently doing some micro benchmarks and tried several things to speedup phpunit in some form.
one idea I had when looking at a hotpath of a app was to replace
with
I am wondering why a plain
rtrim()
is as fast as apreg_replace
call which should have some kind of overhead for working with regex etc?see
PHP Version
8.1.27
Operating System
ubuntu22.04 lts
The text was updated successfully, but these errors were encountered: