Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Reducing $(document) and $(window) functions call to improve performance. #5404
This case is similar with #5402. My team is developing Tizen web UIFW using jQuery Mobile and got a few performance issues and this PR is the first case to improve performance. "$( document )" and "$( window )" functions are repeatly called 73 times on many *.js files and the size of $() function is not small too. So I thought that it would be better to cut down and fix the function call count in performance view.
To resolve the issue my team created two variables to store the return values of the functions and changed the function calls to the variables - $.mobile.$window and $.mobile.$document. Therefore the functions are just called 2 times. After my team tested it on PC and Mobile devices, we got a performance improvement.
To be used in the other funtions the variables are defined in jQuery.mobile on my code. If the variables should be moved to another function, please let me know it.
It is a simple case and similar with #5402. But my team modified many files to cover the issue but the method is very simple. We just change the function calls to using the new variables. If there are any problems or mistakes on my PR, please let me know. Thanks in advance. Happy New Year~!! :)
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
Thanks for the PR! It's a very nice performance improvement.
I pulled your changes in a branch called "pr-5404". There was a small issue in vmouse.js but that is fixed in the branch.
Going to run all tests on that branch now.