Take the tour ×  I created a web page for viewing images. This
page has some other code that gets included that I did not
write. The page loads 40 small images upon load. Then the user
will scroll down and additional pages of 40 images can be loaded
via ajax. Once I get to 15-20 pages, I notice the page begins to
slow significantly. I check app counters and it can go up to
100% cpu and memory can go over 3GB. Then I will inevitably get
the modal that JQuery is taking too long to execute, asking me
if I want to stop executing the script. Now I realize that a
page with up to 800 images is a big load, but the issue with
JQuery suggests to me that some code may also be iterating over
this larger and larger group of dom objects. It almost appears
to get exponentially slower as I pass 15 pages or so. Once I get
to 20 pages it becomes almost unusable.  First of all, is it
even possible to run a page efficiently, even with minimal JS,
when you have this many images? Secondly, is there a recommended
way to "trace" JS