-
Notifications
You must be signed in to change notification settings - Fork 203
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
"different template cached" is more slowy than "different template, different context cached" #18
Comments
I need to look at it, but this is a I don't know the reason why same context is slower. But maybe the function is better warmed up on second test, or GC kicks in or something. These should be run separately so that they don't affect each other. |
The cached functions are after all string concatenation, and the best thing that could happen is that Lua or LuaJIT introduces a proper string buffer. |
@lgfng Actually there was a bug in microbenchmark: there was constant 1000 for the last test. |
@lgfng, also check this: It's really because LuaJIT is poorly handling hash collisions. |
Pull request LuaJIT/LuaJIT#169 |
@lgfng, yes, it seems I have made a bad commit somewhere in the lines. It is fixed now. But the main issue remains, and is discussed in many places, the most recent patch proposal can be found from here: Right now even running the default test with 1 000 iterations is affected by this. I'm not sure how possible is it for this issue to occur on normal code outside this benchmark, but I guess it is not impossible. You may always patch your OpenResty's LuaJIT with this patch, if you fear about it. |
When i run the bench test like this:
The result is :
I found that "different template cached" is more slowy than "different template, different context cached". But i don't know why。
The text was updated successfully, but these errors were encountered: