Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Zeus with process forking strategy #271

Merged
merged 15 commits into from
Oct 24, 2024
Merged

Conversation

jas14
Copy link
Collaborator

@jas14 jas14 commented Oct 23, 2024

Summary

Integration tests without Zeus are very slow because we run each example in a new process, which has to load all dependencies and frameworks – like RSpec, SuperDiff, ActiveSupport, etc – from scratch.

Zeus improved on this, but has a client-server architecture and has been proving somewhat difficult to use. If we instead load the dependencies and then run RSpec in a new forked subprocess, we don't have to reload anything loaded before fork time, and don't have to use Zeus.

Performance

Run on a 10-core Apple M1 Pro with 16 GB RAM.

Bench:

time ./bin/rspec spec/integration/rspec

Before

387.17s user 146.91s system 95% cpu 9:18.77 total

After

88.45s user 21.43s system 97% cpu 1:52.32 total

This represents a ~5x speed-up.

We specifically want test negative `raise_error` expectations, which is
normally a no-no in RSpec.
This should maintain the speedup that Zeus provided by doing effectively
the same thing, namely avoiding the startup cost of loading frameworks
like RSpec and Rails by loading before fork.

This may make it impossible to develop on Windows without further
treatment.
Copy link

Copy link

Copy link

Copy link

Copy link

@jas14 jas14 merged commit 88a123c into main Oct 24, 2024
31 checks passed
@jas14 jas14 deleted the speed-up-integration-tests branch October 24, 2024 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant