-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Optimize prettifyTestMethodName #6474
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
base: main
Are you sure you want to change the base?
Optimize prettifyTestMethodName #6474
Conversation
d3ebf9c to
271c88a
Compare
|
Please share how you benchmark it |
Using a very simple handwritten benchmark. https://3v4l.org/iH2iu/rfc#vgit.master I have also verified that there is an impact by executing the change with phpMyAdmin's test suite.
I am sure you can verify the changes much more scientifically. |
|
I don't need a scientific one. How much does it speedup end-to-end on phpMyAdmin? Thank you |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6474 +/- ##
============================================
- Coverage 96.01% 96.01% -0.01%
+ Complexity 7352 7343 -9
============================================
Files 798 798
Lines 22627 22619 -8
============================================
- Hits 21726 21718 -8
Misses 901 901 ☔ View full report in Codecov by Sentry. |
As measured by xDebug, it's about 2s. Without it, it's difficult to measure because of the unpredictability of the tests due to I/O and HTTP requests. I estimate it's in the range of 100-200 ms for a suite that takes around 35s to execute. |
|
I see, thanks for the indication. the initial PR description sounded more dramatic, so its nice to have a real number on a real project. as the implementation also will be simplified by the change, I would welcome the change. thank you. |


This should optimise the performance of this method by 10x. Regex is much more suitable for a task like this than a loop which reconstructs the string character by character.
ucfirstis twice as fast asstrtoupperwith character substitution. Since this is hot code, the optimisation has a significant impact on the runtime.One behavioural change is that the second regex also skips the digits at the start of the string. Since the return value is trimmed, it makes sense not to add a space at the beginning of the string.