-
Notifications
You must be signed in to change notification settings - Fork 23
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
Use MessageCache to improve label lookup performance #25
Conversation
@kghbln Feel free |
@mwjames How about using i18n to get rid of some of the design problems of the MW stuff and SimpleCache or something similar for the caching? Having a caching i18n thing in the i18n lib would be neat, as it could then tackle this slowness issue for other extensions as well. |
Mmm... I don't think we would gain much because I would still need the Maybe the I can't really see the
Not sure how you want to handle this, in case of SESP you have a fixture (which is the file that contains the expected keys), if you don't have such fixture and only work on loose keys you may end up making endless read/write operations to the cache (which I think is what MW's MessageCache does and that's why you have such poor performance) or you have to fight possible cache fragmentation. Normally it doesn't matter but in case of SESP you have 50+ registrations in one go and suddenly the poor performance of The reason why we can increase performance (citing Xdebug) is because we load all expected keys at once and only refresh the cache at the very end if necessary and in between it is handled like a normal in-memory array lookup. |
solved by SMW::core SemanticMediaWiki/SemanticMediaWiki@a7db203 |
Use MessageCache to improve label lookup performance
Each single wfMessage call costs around 23ms (using Xdebug profiling) which means that when all properties are registered, wfMessage accounts for up-to 2/3 of the overall the processing/computing
(600ms+) time.
This PR introduces a simple MessageCache (wfMessage uses itself a MessageCache but still runs with 20-35ms per call) which allows to minimize the registration time to under 50ms (~0.5 per property).
As soon as the content language changes or the
json
file is being modified the cache becomes invalid.