Conversation
If the mark stack size is too small, it greatly inhibits parallel marking, which is very bad for performance on multi-core systems.
xokdvium
reviewed
Aug 7, 2025
Contributor
xokdvium
left a comment
There was a problem hiding this comment.
Yeah, the wall clock speedup is very noticeable (16.5 vs 22.5s) for nix search nixpkgs hello --no-eval-cache.
Member
Author
|
One thing worth noting is that it makes debugging with GDB slightly more annoying, since you have to tell GDB to ignore the signals used by the stop-the-world GC: |
xokdvium
approved these changes
Aug 7, 2025
Contributor
xokdvium
left a comment
There was a problem hiding this comment.
LGTM, but we need to remember to bring the boehm override to nixpkgs.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
lf-
pushed a commit
to lix-project/lix
that referenced
this pull request
Oct 2, 2025
Using parallel marking in GC speeds up evaluation a fair bit
```
Benchmark 1: ./lix-main/bin/nix search nixpkgs hello --no-eval-cache
Time (mean ± σ): 20.740 s ± 0.046 s [User: 17.583 s, System: 3.062 s]
Range (min … max): 20.678 s … 20.794 s 10 runs
Benchmark 2: ./lix-parallel-marking/bin/nix search nixpkgs hello --no-eval-cache
Time (mean ± σ): 15.037 s ± 0.080 s [User: 19.602 s, System: 3.125 s]
Range (min … max): 14.960 s … 15.227 s 10 runs
Summary
./lix-parallel-marking/bin/nix search nixpkgs hello --no-eval-cache ran
1.38 ± 0.01 times faster than ./lix-main/bin/nix search nixpkgs hello --no-eval-cache
```
Based-on: NixOS/nix#13708
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
Change-Id: Ibc7625f21e0ee7c8ad66203eeb3aca5d83977731
Member
|
See #3973 (comment) for potential issues with parallel marking |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Previously marking was done by only one thread, which takes a long time if the heap gets big. Enabling parallel marking speeds up evaluation a lot, for example (on a Ryzen 9 5900X 12-Core):
nix search nixpkgsfrom 24.3s to 18.9s.NixOS/nix/2.21.2flake regression test from 86.1s to 71.2s.Context
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.