rules_jest
rules_jest copied to clipboard
jest runtime slower then non-bazel
Mostly due to fs sandboxing. The readlinkSync call in nextHopSync fails and throws on most invocations causing substantial cpu usage calculating stack traces.
- Minimize work when calculating stack traces (reduced test time by 50%): https://github.com/aspect-build/rules_js/pull/546
- reduce directory traversing: https://github.com/aspect-build/rules_js/pull/569
- avoid work when outside the sandbox, cache more: https://github.com/aspect-build/rules_js/pull/1007
Measure 3 things:
- non-bazel
- rules_js with patches and no sandbox
- rules_nodejs with patches and no sandbox
also measure: Is the patches overhead a one-time start-up cost or does is scale with number of test cases/specs
Overall the times with vs without the patches scale along with the number of tests, which I assume means number of files loaded. With a single test it seems about 8% slower, with 2k tests it was about 5% slower (using the best times with ~5 tries, very inaccurate but consistent enough I'll trust them).
Curious whether aspect's "mac as local dev" customers|partners|users prefer to disable sandboxing on mac per https://github.com/bazelbuild/bazel/issues/8230#issuecomment-491075400. Confirming that we also tried --experimental_reuse_sandbox_directories and it doesn't seem to help.
Some anecdata: one of our jest test suites (Glean closed source) running under aspect takes ~6x longer to execute with the sandbox enabled vs not. 1 minute vs 6 minutes.