High CPU with localStorage reference

I am developing an Angular 1.4.5 application that uses a service to access the localStorage object to store/retrieve data in a persistent manner.  But as soon as I add a reference to the localStorage object in the editor, the CPU starts spiking between 30% - 60%, and does not come down until I either close that JavaScript file or remove the command.  Here is a sample that causes the issue for me every time, regardless of the file:

 
'use strict';
angular.module('myApp')
  .service('myService', [
    function () {
      var x = localStorage.getItem('myData');
      return
{};
    
}
  ]);
  

Any help is appreciated.  Sort of hard to code when the keyboard buffer is constanly lagging.

Thanks!

1 comment
Comment actions Permalink

In tracing my CPU issues, it seems that I additionally am seeing high CPU utilization with these lines:

 
var _elementStyle = window.getComputedStyle(_myObject);
var _testElementStyle= _elementStyle.height;

It seems (on the surface, at least) that several of the newer ES5 constructs may be causing performance issues in the editor...

0

Please sign in to leave a comment.