eddyerburgh / vue-unit-test-perf-comparison

Comparison of Vue SFC unit tests using different test runners
MIT License
64 stars 7 forks source link

Why Mocha is faster than Jest? Or maybe add profiles with parallel execution enabled #3

Open seyfer opened 5 years ago

seyfer commented 5 years ago

From this AirBnb article, I see that they had a completely different experience than I see in this repo profile results.

https://medium.com/airbnb-engineering/unlocking-test-performance-migrating-from-mocha-to-jest-2796c508ec50

Does it mean that these results are outdated? Or they do not consider Jest built-in parallelization feature?

Please update the results.

eddyerburgh commented 5 years ago

These tests were run two years ago, so it's possible they are outdated.

You can run the tests yourself if you like and see if the results match your expectations

seyfer commented 5 years ago

@eddyerburgh

npm test

> vue-test-utils-perf-test@1.0.0 test /var/www/vue-unit-test-perf-comparison
> ./test.sh

getting average of 10 tests in tape ...
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
seyfer@seed:~$ npm -v
6.9.0
seyfer@seed:~$ node -v
v11.15.0
cat RESULTS.md 
| Runner        | 10 tests  | 100 tests  | 1000 tests | 5000 tests |
| :------------ |:--------- |:---------  |:---------  |:--------- |
| tape | s |  s |  s |  s |
| jest | s |  s |  s |  s |
| mocha-webpack | s |  s |  s |  s |
| karma-mocha | s |  s |  s |  s |
| ava | s |  s |  s |  s |
seyfer commented 5 years ago

@eddyerburgh fixed in #4

my results are

| Runner        | 10 tests  | 100 tests  | 1000 tests | 5000 tests |
| :------------ |:--------- |:---------  |:---------  |:--------- |
| tape | .23s |  .21s |  .22s |  .34s |
| jest | .39s |  .30s |  .23s |  .24s |
| mocha-webpack | .21s |  .21s |  .35s |  .26s |
| karma-mocha | .24s |  .21s |  .22s |  .25s |
| ava | .21s |  .21s |  .22s |  .27s |

| Runner        | 10 tests  | 100 tests  | 1000 tests | 5000 tests |
| :------------ |:--------- |:---------  |:---------  |:--------- |
| tape | .21s |  .21s |  .23s |  .33s |
| jest | .22s |  .37s |  .28s |  .24s |
| mocha-webpack | .25s |  .24s |  .30s |  .32s |
| karma-mocha | .26s |  .21s |  .29s |  .24s |
| ava | .21s |  .21s |  .22s |  .23s |

which I still find strange. :)