browserstate / history.js

History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. Including continued support for data, titles, replaceState. Supports jQuery, MooTools and Prototype. For HTML5 browsers this means that you can modify the URL directly, without needing to use hashes anymore. For HTML4 browsers it will revert back to using the old onhashchange functionality.
http://browserstate.github.com/history.js/demo/
Other
10.75k stars 1.35k forks source link

High CPU usage #462

Open assembledadam opened 7 years ago

assembledadam commented 7 years ago

Got a dual quad core 2015 Macbook Pro, and I'm getting history.js using 12-16% of my CPU constantly (Chrome 52, MacOS El Capitan).

I've traced the problem to the call of History.onUnload = function() - this accounts for 90%+ of the CPU usage.

Specifically I think this is being called continuously - the offending line appears to be:

// For Internet Explorer
History.intervalList.push(setInterval(History.onUnload,History.options.storeInterval));

For non IE perhaps we should avoid this line?

assembledadam commented 7 years ago

Update: looks to be the same report as https://github.com/browserstate/history.js/issues/321 and a couple of others. Seems odd why nobody has addressed this in the repo yet.