question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New Feature - Read data from the RAM (don't always read the file content)

See original GitHub issue

I dug up a little inside the conf module code and appears to me that each get/read function call uses the fs readFileSync to get the data from the config file. If I need to constantly check for a value from the app settings it can lead to performance issues. So my approach is to copy the settings to a global variable 👎 and only use this module to write the config file when some changes occur.

Are any alternative approach to this problem or do you plan to add a feature to kinda “cache the values” and only reads the file when there are some changes?

Thank you

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:9

github_iconTop GitHub Comments

2reactions
samuelcarreiracommented, Nov 18, 2019

I am currently working on a alternative library to save the settings. Main highlights:

  • Very lightweight (only native node modules)
  • Save/Read settings to/from RAM.
  • Uses fastest validation
  • Setting can be shared from the main process to the renderer process
  • only saves data to disk if needed (saves write cycles on SSDs)

I will post here when I publish the process

1reaction
samuelcarreiracommented, Apr 7, 2020

@sayem314 It’s only for electron

@papb the electron-store is basically a wrapper of the conf module, so the complaints are the same

Read more comments on GitHub >

github_iconTop Results From Across the Web

13. Files — How to Think Like a Computer Scientist
While a program is running, its data is stored in random access memory (RAM). ... By reading and writing files, programs can save...
Read more >
How to initialize RAM from file using TEXTIO - VHDLwhiz
First, we need to read the characters one by one from the text_line object, then we decode their values and assign them to...
Read more >
How can I read large text files line by line, without loading ...
I want to read a large file (>5GB), line by line, without loading its entire contents into memory. I cannot use readlines() since...
Read more >
What is RAM (Random Access Memory)? - TechTarget
RAM is the main memory in a computer. It is much faster to read from and write to than other kinds of storage,...
Read more >
Reading file data with PowerShell - SQLShack
The latest version of PowerShell and many earlier versions of PowerShell come with the Get-Content function and it allows us to easy read...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found