Ticket #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: | |
| Blocking: | Blocked by: |
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
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
