sebhildebrandt / systeminformation

System Information Library for Node.JS
MIT License
2.72k stars 309 forks source link

fsSize() is too slow #429

Closed aleksey-hoffman closed 3 years ago

aleksey-hoffman commented 4 years ago

Hey @sebhildebrandt thanks for creating the module!

Have you considered turning it into a native C++ module based on N-API (or creating a separate native NPM module)? It would allow you to make every single function faster and add additional features.

Describe the bug systeminformation.fsSize() is ~900 times slower than node-diskusage:

To Reproduce

const diskusage = require('diskusage')
const systeminformation = require('systeminformation')

let drives = await systeminformation.blockDevices()

console.time('TIME: systeminformation')
await systeminformation.fsSize()
console.timeEnd('TIME: systeminformation')

for (let index = 0; index < drives.length; index++) {
  console.time('TIME: diskusage')
  const size = await diskusage.check(drives[index].mount)
  console.timeEnd('TIME: diskusage')
}

Current Output Current execution time: ~90 ms

Expected behavior Desired execution time: ~0.1 - 1 ms

Environment (please complete the following information):

sebhildebrandt commented 3 years ago

@aleksey-hoffman ... Thank you for your suggestion, I get your point. Currently I do not have plans to implement parts in C++. I do know, that there is a huge potential especially on windows for a lot of functions. I will keep this in mind for maybe a new major release of system-information

sebhildebrandt commented 3 years ago

Closing it for now.