Skip to content

Instantly share code, notes, and snippets.

@ncuillery
Last active February 16, 2016 11:27
Show Gist options
  • Save ncuillery/0e0dbce66a9281de6fde to your computer and use it in GitHub Desktop.
Save ncuillery/0e0dbce66a9281de6fde to your computer and use it in GitHub Desktop.
Jest 0.9.x measurements

I did some measurements of the "warm-up" time of both version 0.8.2 and 0.9.0.

I've add Date.now() here and here, and I did the same on the equivalent lines on master.

0.8.2

All tests:

$ jest
Using Jest CLI v0.8.2, jasmine2
1455616528759
1455616532214  -------> 3455ms
 PASS  tests/units/src/app/modules/user/user.plugin.spec.js (7.379s)
 PASS  tests/units/src/app/views/pages/bannerPlayer.page.spec.js (8.134s)
 PASS  tests/units/src/app/views/partials/headerTvShow.partial.spec.js (9.071s)
 [...]

$ jest
Using Jest CLI v0.8.2, jasmine2
1455616691344
1455616694435 -------> 3091ms
 PASS  tests/units/src/app/views/pages/live.page.spec.js (7.707s)
 PASS  tests/units/src/app/views/pages/bannerPlayer.page.spec.js (7.975s)
 [...]

$ jest
Using Jest CLI v0.8.2, jasmine2
1455616836056
1455616842780 -------> 6724ms
 PASS  tests/units/src/app/views/pages/bannerPlayer.page.spec.js (8.03s)
 PASS  tests/units/src/app/views/pages/live.page.spec.js (8.203s)
 PASS  tests/units/src/app/views/partials/headerTvShow.partial.spec.js (8.997s)
 [...]

$ jest
Using Jest CLI v0.8.2, jasmine2
1455617220013
1455617226912 -------> 6899ms
 PASS  tests/units/src/app/modules/user/user.plugin.spec.js (7.434s)
 PASS  tests/units/src/app/views/pages/bannerPlayer.page.spec.js (8.519s)
 [...]

$ jest
Using Jest CLI v0.8.2, jasmine2
1455617334783
1455617337426 -------> 2643ms
 PASS  tests/units/src/app/modules/clip/components/clip.component.spec.js (4.857s)
 PASS  tests/units/src/app/views/pages/bannerPlayer.page.spec.js (7.593s)
 PASS  tests/units/src/app/views/partials/headerTvShow.partial.spec.js (9.382s)
 [...]

$ jest
Using Jest CLI v0.8.2, jasmine2
1455619914497
1455619915236 -------> 739ms
 PASS  tests/units/src/app/plugins/raven.plugin.spec.js (0.308s)
 PASS  tests/units/src/app/modules/catchup/stores/catchup.store.spec.js (0.754s)
 PASS  tests/units/src/app/plugins/http.plugin.spec.js (0.636s)
 [...]

$ jest
Using Jest CLI v0.8.2, jasmine2
1455620228499
1455620229468 -------> 969ms
 PASS  tests/units/src/app/views/pages/live.page.spec.js (7.921s)
 PASS  tests/units/src/app/views/pages/bannerPlayer.page.spec.js (8.169s)
 PASS  tests/units/src/app/views/partials/headerTvShow.partial.spec.js (8.698s)
 [...]

I can't observe any pattern or rule behind these measurements 😒 The "warm-up" time varies from 600ms to 7s (I made more essays than the trace above)

"Heavy" single test

I ran the single test mutiple times. It is a React component with a lot of dependencies (sub-components, actions, etc.)

$ jest live.page
Using Jest CLI v0.8.2, jasmine2
1455617550775
1455617551378 -------> 603ms
 PASS  tests/units/src/app/views/pages/live.page.spec.js (3.874s)
11 tests passed (11 total in 1 test suite, run time 4.734s)

$ jest live.page
Using Jest CLI v0.8.2, jasmine2
1455617582539
1455617583137 -------> 598ms
 PASS  tests/units/src/app/views/pages/live.page.spec.js (3.96s)
11 tests passed (11 total in 1 test suite, run time 4.847s)

$ jest live.page
Using Jest CLI v0.8.2, jasmine2
1455617602340
1455617602944 -------> 603ms
 PASS  tests/units/src/app/views/pages/live.page.spec.js (3.971s)
11 tests passed (11 total in 1 test suite, run time 4.852s)

Warm-up time stable at 600ms

"Light" single test

Here is the trace of multiple single test runs of an action (few dependencies)

$ jest loadFolders
Using Jest CLI v0.8.2, jasmine2
1455617634687
1455617635286 -------> 599ms
 PASS  tests/units/src/app/modules/folder/actions/loadFolders.action.spec.js (0.496s)
4 tests passed (4 total in 1 test suite, run time 1.372s)

$ jest loadFolders
Using Jest CLI v0.8.2, jasmine2
1455617650669
1455617651262 -------> 593ms
 PASS  tests/units/src/app/modules/folder/actions/loadFolders.action.spec.js (0.492s)
4 tests passed (4 total in 1 test suite, run time 1.372s)

$ jest loadFolders
Using Jest CLI v0.8.2, jasmine2
1455617661508
1455617662102 -------> 594ms
 PASS  tests/units/src/app/modules/folder/actions/loadFolders.action.spec.js (0.484s)
4 tests passed (4 total in 1 test suite, run time 1.356s)

Warm-up time stable at 600ms

0.9.0

All tests:

$ jest
Using Jest CLI v0.9.0, jasmine2
1455618297513
1455618305888 -------> 8375ms
 PASS  tests/units/src/app/modules/search/components/searchClipResult.component.spec.js (2.658s)
 PASS  tests/units/src/app/modules/clip/components/clip.component.spec.js (3.093s)
 PASS  tests/units/src/app/views/pages/bannerPlayer.page.spec.js (3.779s)
 [...]

$ jest
Using Jest CLI v0.9.0, jasmine2
1455618410925
1455618419461 -------> 8536ms
Running 189 test suites...[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()
 PASS  tests/units/src/app/modules/clip/components/clip.component.spec.js (2.968s)
 PASS  tests/units/src/app/views/pages/bannerPlayer.page.spec.js (3.666s)
 PASS  tests/units/src/app/views/partials/headerTvShow.partial.spec.js (3.744s)
 [...]

$ jest
Using Jest CLI v0.9.0, jasmine2
1455618552973
1455618561696 -------> 8723ms
 PASS  tests/units/src/app/views/pages/bannerPlayer.page.spec.js (3.734s)
 PASS  tests/units/src/app/views/pages/live.page.spec.js (4.093s)
 PASS  tests/units/src/app/views/partials/headerTvShow.partial.spec.js (4.229s)
 [...]

$ jest
Using Jest CLI v0.9.0, jasmine2
1455618490830
1455618499448 -------> 8618ms
Running 189 test suites...[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()
 PASS  tests/units/src/app/modules/clip/components/clip.component.spec.js (3.14s)
 PASS  tests/units/src/app/views/pages/bannerPlayer.page.spec.js (3.737s)
 PASS  tests/units/src/app/views/partials/headerTvShow.partial.spec.js (3.78s)
 [...]

As I said the total execution time is dropped by 3 and the "warm-up" time slightly increased but it is stable at 8.6s

"Heavy" single test

$ jest live.page       
Using Jest CLI v0.9.0, jasmine2
1455618839568
1455618848161 -------> 8593ms
 PASS  tests/units/src/app/views/pages/live.page.spec.js (1.848s)
11 tests passed (11 total in 1 test suite, run time 2.84s)

$ jest live.page
Using Jest CLI v0.9.0, jasmine2
1455618872779
1455618881389 -------> 8610ms
 PASS  tests/units/src/app/views/pages/live.page.spec.js (2.019s)
11 tests passed (11 total in 1 test suite, run time 2.863s)

$ jest live.page
Using Jest CLI v0.9.0, jasmine2
1455618895833
1455618904431 -------> 8598ms
 PASS  tests/units/src/app/views/pages/live.page.spec.js (1.868s)
11 tests passed (11 total in 1 test suite, run time 2.857s)

$ jest live.page
Using Jest CLI v0.9.0, jasmine2
1455618919714
1455618928467 -------> 8753ms
 PASS  tests/units/src/app/views/pages/live.page.spec.js (2.006s)
11 tests passed (11 total in 1 test suite, run time 2.881s)

Same warm-up time as the whole suite: 8.6s

It seems a single test run is significantly slower. The whole command takes 11s:

$ date && jest live.page && date
mardi 16 février 2016, 11:36:41 (UTC+0100)
Using Jest CLI v0.9.0, jasmine2
1455619001299
1455619009917 -------> 8618ms
 PASS  tests/units/src/app/views/pages/live.page.spec.js (2.009s)
11 tests passed (11 total in 1 test suite, run time 2.863s)
mardi 16 février 2016, 11:36:52 (UTC+0100)

"Light" single test

$ jest loadFolders              
Using Jest CLI v0.9.0, jasmine2
1455619055368
1455619063841 -------> 8473ms
 PASS  tests/units/src/app/modules/folder/actions/loadFolders.action.spec.js (0.346s)
4 tests passed (4 total in 1 test suite, run time 1.323s)

$ jest loadFolders
Using Jest CLI v0.9.0, jasmine2
1455619082350
1455619091060 -------> 8710ms
 PASS  tests/units/src/app/modules/folder/actions/loadFolders.action.spec.js (0.404s)
4 tests passed (4 total in 1 test suite, run time 1.259s)

$ jest loadFolders
Using Jest CLI v0.9.0, jasmine2
1455619098294
1455619106904 -------> 8610ms
 PASS  tests/units/src/app/modules/folder/actions/loadFolders.action.spec.js (0.346s)
4 tests passed (4 total in 1 test suite, run time 1.319s)

$ jest loadFolders
Using Jest CLI v0.9.0, jasmine2
1455619118756
1455619127518 -------> 8762ms
 PASS  tests/units/src/app/modules/folder/actions/loadFolders.action.spec.js (0.402s)
4 tests passed (4 total in 1 test suite, run time 1.273s)

Exactly the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment