-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
Speed up StringTools.(starts|ends)With on Lua #10983
Conversation
Shouldn't we have a way of calling this sub-function without using |
As I mentioned in the description, using the NativeStringTools comes with a performance penalty (I suspect because of the emulated @:multiReturn handling). In my tests the overhead was up to 100%. |
Yes I read that this is your observation, my question is why that is the case. If using But I'm not very familiar with lua, so I can't really estimate the effort to address this "properly". If you say that this is at least a pragmatic approach then I'm happy to merge it. |
I cannot really answer the question why it is faster using the untyped version. Anyways, I replaced it with NativeStringTools.sub for now to avoid any confusion. This still is a win as it also is considerably (9 times) faster than the current implementation. |
f92dad0
to
3172788
Compare
I'm seeing this:
|
I will look into it |
apparently it does not work when using |
@Simn, tests are green now. |
Hmpf, I'm very reluctant to add something involving |
With this PR applied StringTools.startsWith is 10 times faster and StringTools.endsWith is 6 times faster on Lua.
It is also faster than using
lua.NativeStringTools.sub
which instantiates - in this case unnecessary - temporary @:multiReturn objects.