Skip to content

os: improve networkInterfaces performance

This algorithm uses less data transformations and is therefore significantly faster than the one before.

The main pain point is how the CIDR suffix is calculated. It would be best to port this to C++ instead of having to do this in JS as all other transformations are done in C++. But since this improves the performance already quite a bit it's a good first step.

Performance:

> console.time(); for(var i = 0; i < 10000; i++) os.networkInterfaces(); console.timeEnd()

// Before
default: 1170.912ms

// After:
default: 758.899ms
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading