Skip to content

feat(memtrack): resolve allocator libs without scanning the whole nix store#431

Draft
GuillaumeLagrange wants to merge 1 commit into
mainfrom
memtrack-nix-speedup
Draft

feat(memtrack): resolve allocator libs without scanning the whole nix store#431
GuillaumeLagrange wants to merge 1 commit into
mainfrom
memtrack-nix-speedup

Conversation

@GuillaumeLagrange

Copy link
Copy Markdown
Contributor

Dynamic discovery globs /nix/store/glibc/lib/libc.so.6 and gcc/libstdc++, matching every version in the store (each a distinct file, so dedup can't collapse them). memtrack then attaches uprobes to all of them even though the target loads one, which made a trivial run take minutes on a nix machine.

Add two opt-in escape hatches, checked before the glob:

  • CODSPEED_MEMTRACK_ALLOCATOR_LIBS: explicit path-list of allocator libraries.
  • CODSPEED_MEMTRACK_AUTO_LIBS: toggle that auto-resolves the libraries the target binaries (CODSPEED_MEMTRACK_BINARIES, already set by the runner) actually load, via each binary's own loader in list mode (honours nix RPATH).

Both fall back to the existing glob when nothing is set or resolved, so default behaviour is unchanged. On a nix box this cuts discovery from 25 attached allocator instances (>2 min) to 1 (~1.8 s).

… store

Dynamic discovery globs /nix/store/*glibc*/lib/libc.so.6 and *gcc*/libstdc++,
matching every version in the store (each a distinct file, so dedup can't
collapse them). memtrack then attaches uprobes to all of them even though the
target loads one, which made a trivial run take minutes on a nix machine.

Add two opt-in escape hatches, checked before the glob:

- CODSPEED_MEMTRACK_ALLOCATOR_LIBS: explicit path-list of allocator libraries.
- CODSPEED_MEMTRACK_AUTO_LIBS: toggle that auto-resolves the libraries the
  target binaries (CODSPEED_MEMTRACK_BINARIES, already set by the runner)
  actually load, via each binary's own loader in list mode (honours nix RPATH).

Both fall back to the existing glob when nothing is set or resolved, so default
behaviour is unchanged. On a nix box this cuts discovery from 25 attached
allocator instances (>2 min) to 1 (~1.8 s).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codspeed-hq

codspeed-hq Bot commented Jul 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 7 untouched benchmarks


Comparing memtrack-nix-speedup (facc889) with main (7ce2c98)

Open in CodSpeed

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