Closed maciek-codes closed 5 years ago
Created a pull request #786
@macqm Thank you for reporting this issue and submitting the PR. We are reviewing it and will update you here.
@macqm We have merged your PR. I will update this issue when we release a new version. Thanks for your contribution! Closing this issue for now.
While analyzing performance traces from Edge browser, I noticed that
AuthenticationContext.prototype._supportsLocalStorage
causes some CPU spikes and an extra perf hit related to the use of local storage. It appers that the method checks ifwindow.localStorage
is present and does tests it by writing, reading and deleteing a value under 'testkey' key.While I understand this may be needed for some compatibility reasons (which are not known to me), I would strongly encourage caching the value of that check. I saw UI delays in Edge coming from login.microsoft.com due to higher pressure on local storage. Some other internal websites that use adal.js suffer more from CPU spikes cause by this redundant local storage access.
For every
AuthenticationContext.prototype._getItem
the penalty is an extra write, extra read and an extra delete operations. Same goes for every call toAuthenticationContext.prototype._saveItem
.