electron-userland / electron-json-storage

:package: Easily write and read user settings in Electron apps
1.43k stars 79 forks source link

.getAll is kinda slow. how can I speed it up? #117

Open MarlonCopeland opened 5 years ago

MarlonCopeland commented 5 years ago

I set my path to be a separate folder that will only hold my app's json values. But when trying to pull all the values (which is only 1) it takes like 5 seconds.. can you help me speed this up?

jviotti commented 5 years ago

Hey @MarlonCopeland ,

That's very weird! What OS are you running this on? Do you have a small reproducible example I can try from my side? This module uses fs under the hood, which should be very fast. The only reason for the slow down that I can think of is that electron-json-storage might be retrying multiple times to obtain the lock. Maybe try attaching a debugger, stepping through the code, and see if you hit the retry logic from the lockfile module (a dependency of electron-json-storage)?

Let me know what you found. I might be able to help more given more info!