]> git.proxmox.com Git - pve-eslint.git/commit
use worker_threads for linting
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 19 Jul 2021 10:13:12 +0000 (12:13 +0200)
committerDominik Csapak <d.csapak@proxmox.com>
Mon, 19 Jul 2021 10:22:13 +0000 (12:22 +0200)
commitaa1e5f5ecd161ccf2e3f80b1a69d7e324809ba13
tree397ecf47f7580ff46a444823aadf50720eb7631c
parent39179db1a899291338657dfee66bde9892bf6a75
use worker_threads for linting

instead linting all files in the main thread, use worker threads
for that (4 by default) and add the '-t' switch to able to control that

a basic benchmark of eslint of pve-manager showed some performance
gains:

Benchmark #1: Current
  Time (mean ± σ):      6.468 s ±  0.116 s    [User: 9.803 s, System: 0.333 s]
  Range (min … max):    6.264 s …  6.647 s    10 runs

Benchmark #2: 2Threads
  Time (mean ± σ):      4.509 s ±  0.106 s    [User: 12.706 s, System: 0.530 s]
  Range (min … max):    4.335 s …  4.674 s    10 runs

Benchmark #3: 4Threads
  Time (mean ± σ):      3.471 s ±  0.033 s    [User: 16.390 s, System: 0.630 s]
  Range (min … max):    3.431 s …  3.542 s    10 runs

Benchmark #4: 8Threads
  Time (mean ± σ):      2.880 s ±  0.044 s    [User: 22.454 s, System: 0.938 s]
  Range (min … max):    2.813 s …  2.964 s    10 runs

Summary
  '8Threads' ran
    1.21 ± 0.02 times faster than '4Threads'
    1.57 ± 0.04 times faster than '2Threads'
    2.25 ± 0.05 times faster than 'Current'

after 8 threads, there were no real performance benefits since the
overhead to load the module seems to be the biggest factor.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/bin/app.js
src/index.js
src/lib/worker.js [new file with mode: 0644]
src/package.json