Permalink
Please
sign in to comment.
Browse files
os: improve networkInterfaces() performance
PR-URL: #25410 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
- Loading branch information...
Showing
with
62 additions
and 55 deletions.
- +15 −0 benchmark/os/networkInterfaces.js
- +29 −18 lib/os.js
- +18 −37 src/node_os.cc
| @@ -0,0 +1,15 @@ | |||
| 'use strict'; | |||
|
|
|||
| const common = require('../common.js'); | |||
| const networkInterfaces = require('os').networkInterfaces; | |||
|
|
|||
| const bench = common.createBenchmark(main, { | |||
| n: [1e4] | |||
| }); | |||
|
|
|||
| function main({ n }) { | |||
| bench.start(); | |||
| for (var i = 0; i < n; ++i) | |||
| networkInterfaces(); | |||
| bench.end(n); | |||
| } | |||
0 comments on commit
840ec23