Very poor io perf when read/write to localStorage


I’m trying to move to local builds for android and iOS. As part of that move, I’ve udpate to recent versions accross the board.

ios: 11.2.1
cordova: 7.1.0
ios cordova: 4.5.4

When I start my app, I’m accessing localStorage to fetch cached values. Since I’m building it locally using xcode, that access got super slow. It takes about 2min to write ~135K of data. Everything is super fast on my current version I have deployed.

Is there something I miss in my build settings?

Note: I’ve quickly tried the native storage plugin and sure enough, that restores the perf I used to see. However, that goes a long way in adding async access (especially for reads) accross the app, which I rather avoid doing if possible.

Thanks for any pointers.

The way you build should not really influence the performance of any code.

What command are you using to build?
What is your ionic info output?

Sorry, for not providing this initially:

cli packages: (/Users/patrickAir/Documents/GitHub/troody/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0 
Gulp CLI              : CLI version 3.9.1 Local version 3.9.1

local packages:

Cordova Platforms : ios 4.5.4
Ionic Framework   : unknown


ios-deploy : 1.9.2 
Node       : v8.8.1
npm        : 5.6.0 
OS         : macOS High Sierra
Xcode      : Xcode 9.2 Build version 9C40b 

Environment Variables:

ANDROID_HOME : not set


backend : pro

Forgto: I’m building using Xcode 9.2.

Nothing here points to a reason why localStorage should be slower.

Sorry, no idea what is causing this.

I found out what was causing the poor perf, it was logging to the console. The wrapper I’ve had was dumping everything to the console as well (stringyfied), which was causing the enormous delays. As soon as I stopped the logging, things started to be smooth again.

It looks like that part changed for some reason, I’ve never experienced any problems with this so far.


A valuable piece of advice!