-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Performance of reimplemented functions? #167
Comments
this is expected, if you are using PHP >= 7.4, i recommend including |
Hm, after https://phpsandbox.io/n/wispy-leaf-75nn-pnldg, i noticed that the unqiue function is causing the performance issue here, not I think there's a way to fix this. in https://github.com/azjezz/psl/blob/1.6.x/src/Psl/Dict/unique.php#L17, we should add
can you please send a PR and verify that performance has been improved in this case specifically? P.S: any pull request to improve performance is welcome, even if it adds complexity. |
I understand that a completely reimplemented function in userland code will be slower than the compiled C counterpart, yet I thought that for many functions PSL simply implemented a wrapper for native functions, thus having little overhead.
I got a little surprised when I was replacing some instances of
\array_unique
of suddenly getting a measurable drop in performance (those are rather large arrays, but that's what I get).Here I can replicate it with this code:
The result in this case is 0.0009 seconds for native implementations, against 0.0841 seconds for using Psl. True, for this case 0,08 seconds is still something I can live with, but it's still a very marked cost increase. For my particular use case can even become problematic.
Is this what's expected, or I'm using the library incorrectly? Mind, this is not in no way a complaint, I love the library even if this is a tradeoff to be aware of, but just wanted to be sure this was not me "holding it wrong".
The text was updated successfully, but these errors were encountered: