Thus, my webpage uses a lot of jquery all over the world. This is a one page javascript application, and I pretty much create all the HTML manually using jquery. I have many divs in which I use draggable and resizable. I also use jquery-ui-effects.hide and .show with slide animations to move some divs.
When I run the application, everything works flawlessly, but after 10-15 minutes when the page is open, everything that uses jquery-ui methods becomes so slow that it is unusable. When I try to resize one of my divs, there is a serious slowdown when I first mousedown on the corner, and after I release the click, it takes a few seconds for the page to become responsive again. The same is true for drag and drop. Call $ (). Draggable and $ (). Resizable on divs also takes a lot of time. It is strange that dragging and resizing are not slow, only start / end. The longer the page is open, the slower it becomes.
All the other functionality on the page works fine even after one hour of the open page (I even have a basic picture on the canvas, but other jquery functions, but not jquery-ui, also work fine). There is no aparent memory leak since the browser never uses more than 150 mb of used memory.
Some people may say that the problem is that my functions start / stop resize / drag. This is not so, because I tried to remove them without any changes in speed, and this will not explain the slowdown of the animation.
CPU utilization is 100% (I use one main system) during the animation, it remains at 0% if the jquery-ui function is not used. When profiling the animation function (after opening the page for more than 30 minutes), I see that there is a method called curCSS (jquery-1.8.1.js line 6672) using 95% of the processor time. The same function uses only 4.5% if I started the animation a few seconds after starting the application.
I am using jquery-1.8.1 and jquery-ui 1.8.22.
I canβt post all the code because I donβt know which part is wrong, and the whole code base is huge. Animation is performed as follows:
//internal code that prevents updating data on the divs that are part of the animation var hiding= true; var showing= true; containerToHide.$div.hide("slide", {direction: "left"}, 1000, function() { hiding= false; if (!showing) { //both animations ended //internal code to allow update data on div after animation ends } }); containerToShow.$div.show("slide", {direction: "right"}, 1000, function() { showing= false; if (!hiding) {//both animations ended //internal code to allow update data on div after animation ends } });
I do not think this is a problem, although the animation is pretty standard.
Any hints on what to look for would be greatly appreciated.