antoniopresto / react-native-local-mongodb

react-native local mongodb storage.
MIT License
304 stars 66 forks source link

Insertion Performance #45

Closed SaltySammy closed 5 years ago

SaltySammy commented 5 years ago

InsertAsync Method takes an average of 110 ms. is this normal behavior or am I doing something wrong? here is the sample code I used to test this out.

            let start = Date.now();
            let result = await Messages.insertAsync(msg);
            let elpased = (Date.now()-start);
            console.log(elpased);
antoniopresto commented 5 years ago

IOs or Android? prod or dev? Try compare these options with pure AsyncStorage.setItem

SaltySammy commented 5 years ago

Yes, the root cause of the problem is AsyncStorage I guess. both getItem and setItem really slow, turning off the Remote JS Debugger helps but it's still way above 100ms. then I have tested it on different physical devices and the results varied a lot ranging from 6ms to 150ms depending on the device. I think it's related to the API level somehow because the best result I got was from Oreo AVD. All tests were done on Android devices with both production and dev builds.