Bug Tracker

Opened 10 years ago

Closed 9 years ago

#5646 closed bug (worksforme)

Long AJAX request takes all CPU on Chrome

Reported by: SamePaul Owned by:
Priority: minor Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: ajax chrome Cc:
Blocked by: Blocking:

Description

As I noticed jQuery does not use onredaystatechange callback of XMLHTTPRequest, but instead uses timer to frequently poll readyState property. Resolution set to be 13 milliseconds, which seems to be overkill. Moreover on Google Chrome it causes 100% CPU load during active AJAX requests. I changed polling interval to 100ms and observed normal CPU load without noticeable sacrificing in XHR response, because for human difference between 10ms and 100ms absolutely negligible, but for browser it makes sense. Moreover, I think that offloading browser from such a frequent task jQuery lets it process other events more quickly, thus improving overall web application performance.

Change History (2)

comment:1 Changed 9 years ago by dmethvin

Component: unfiledajax

comment:2 Changed 9 years ago by snover

Resolution: worksforme
Status: newclosed

Current versions of jQuery use onreadystatechange and do not poll.

Note: See TracTickets for help on using tickets.