clitetailor / rxjs-overlap-map

0 stars 0 forks source link

Jest startup time is slow #1

Open clitetailor opened 6 years ago

clitetailor commented 6 years ago

@imcvampire Can you help me with this? :3

clitetailor commented 6 years ago

Here is my system info:

Host Name:                 LEVELMENT
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.17134 N/A Build 17134
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
Original Install Date:     12-May-18, 10:13:53 PM
System Boot Time:          10-Oct-18, 4:25:09 PM
System Manufacturer:       ASUSTeK COMPUTER INC.
System Model:              K501LX
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 61 Stepping 4 GenuineIntel ~2394 Mhz

And coverage usage:

$ time npm run coverage

> jest --coverage

 PASS  __test__/index.test.js
  overlapMap
    √ should output 1, 5 (512ms)
    √ should execute in parallel (503ms)
  sequentialMap
    √ should work the same with `mergeMap` (602ms)
    √ should work the same with `concatMap` (1502ms)

----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |      100 |      100 |      100 |      100 |                   |
 index.js |      100 |      100 |      100 |      100 |                   |
----------|----------|----------|----------|----------|-------------------|
Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        6.449s
Ran all test suites.

real    0m10.516s
user    0m0.030s
sys     0m0.136s
clitetailor commented 6 years ago

https://github.com/facebook/jest/issues/1986

clitetailor commented 6 years ago

IMO, this is not antivirus problem. For example with Mocha with Babel Register, and Chai, and JSDom and Enzyme, ...:

$ time pnpm test

> mocha --opts mocha.opts

  6 passing (183ms)

real    0m24.996s
user    0m0.060s
sys     0m0.152s

$ time pnpm test

> mocha --opts mocha.opts

  6 passing (146ms)

real    0m5.077s
user    0m0.030s
sys     0m0.106s

$ time pnpm test

> mocha --opts mocha.opts

  6 passing (151ms)

real    0m5.098s
user    0m0.030s
sys     0m0.152s

Jest (Jest Babel only) all output with the same usage:

$ time pnpm test
> jest --config jest.config.js

Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        6.968s
Ran all test suites.

real    0m9.646s
user    0m0.045s
sys     0m0.183s

$ time pnpm test
> jest --config jest.config.js

Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        8.286s
Ran all test suites.

real    0m11.797s
user    0m0.061s
sys     0m0.121s

$ time pnpm test
> jest --config jest.config.js

Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        4.937s, estimated 6s
Ran all test suites.

real    0m9.257s
user    0m0.030s
sys     0m0.136s
clitetailor commented 6 years ago

Tested with Mocha. The performance really impressive:

$ time pnpm test

> mocha --opts mocha.opts

  overlapMap
    √ should output 1, 5 (512ms)
    √ should execute in parallel (501ms)

  sequentialMap
    √ should work the same as `mergeMap` (602ms)
    √ should work the same as `concatMap` (1504ms)

  4 passing (3s)

real    0m7.058s
user    0m0.030s
sys     0m0.091s

$ time pnpm test

> mocha --opts mocha.opts

  4 passing (3s)

real    0m6.049s
user    0m0.030s
sys     0m0.135s
clitetailor commented 6 years ago

I run both build, both test and both coverage in 9.937s. Can you be faster? :3

https://github.com/clitetailor/rxjs-overlap-map/tree/experiment/mocha

$ time npm run coverage

> npm run build && nyc mocha --opts mocha.opts
> rollup -c

index.js → dist/rxjs-overlap-map.js, dist/rxjs-overlap-map.umd.js...
(!) Unresolved dependencies
https://rollupjs.org/guide/en#warning-treating-module-as-external-dependency
rxjs/operators (imported by index.js)
created dist/rxjs-overlap-map.js, dist/rxjs-overlap-map.umd.js in 360ms

  overlapMap
    √ should output 1, 5 (510ms)
    √ should execute in parallel (503ms)

  sequentialMap
    √ should work the same as `mergeMap` (603ms)
    √ should work the same as `concatMap` (1503ms)

  4 passing (3s)

---------------------|----------|----------|----------|----------|-------------------|
File                 |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
---------------------|----------|----------|----------|----------|-------------------|
All files            |      100 |      100 |      100 |      100 |                   |
 rxjs-overlap-map.js |      100 |      100 |      100 |      100 |                   |
---------------------|----------|----------|----------|----------|-------------------|

real    0m9.937s
user    0m0.045s
sys     0m0.120s