Bug Tracker

Modify

Ticket #5646 (closed bug: worksforme)

Opened 4 years ago

Last modified 3 years ago

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

comment:1 Changed 3 years ago by dmethvin

  • Component changed from unfiled to ajax

comment:2 Changed 3 years ago by snover

  • Status changed from new to closed
  • Resolution set to worksforme

Current versions of jQuery use onreadystatechange and do not poll.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.