chore(profiling): clean up code and update Rust dependencies#4038
Conversation
rustc-hash 2 uses a faster, better-finalized hashing algorithm with significantly improved string hashing. This benefits stack string interning, the live heap tracker, and the I/O file descriptor cache without increasing their stored state. Use the crate's FxBuildHasher and FxHashSet aliases instead of local BuildHasherDefault plumbing.
Upgrade rand to 0.9.4 and rand_distr to 0.5.1 together so the profiler uses rand_distr's rewritten large-lambda Poisson sampler. A local two-million-sample release benchmark improved sampling from 121.44 to 33.23 ns at lambda 100 and from roughly 114 to 22 ns at the I/O and allocation lambdas, a 3.7-5.3x speedup. The new sampler also fixes statistical inaccuracies for large lambda values. The tradeoff is that Poisson<f64> grows from 40 to 88 bytes, adding about 432 bytes per NTS PHP thread plus 48 process-wide, or 480 bytes per ZTS thread.
Newer dynasmrt releases handle AArch64 instruction-cache invalidation internally and include a fix for an illegal-instruction crash on Apple AArch64. This directly covers the runtime-generated PHP frameless-call trampolines. Adopt the current .i64 data directive required by dynasm 5. The all-features unit tests pass and a release-built extension successfully executes an internal PHP function through the frameless runtime path.
Pick up newer FFI generation fixes, including safer opaque type layouts, current Rust syntax generation, and compatibility with newer Clang releases. The existing preserve_none opcode-handler workaround remains necessary.
Use bindings synchronized with current Apple 26.1 headers. The profiler's Rust 1.87 toolchain supports mach2's 2024 edition, so the previous edition-based version restriction is no longer needed.
Take the maintained DashMap 6 release and its current synchronization dependencies. This is a maintenance update; no profiler-level performance improvement is claimed without a live heap tracking benchmark.
Update the regex engine and syntax crates required by env_logger 0.11.11.
Update env_filter and log to the versions required by the current env_logger patch release.
|
Benchmarks [ profiler ]Benchmark execution time: 2026-07-10 11:35:52 Comparing candidate commit f3f0c29 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 27 metrics, 9 unstable metrics.
|
bwoebi
left a comment
There was a problem hiding this comment.
Nice cleanup. I like the merging of zts+debug checks :-D
Description
This PR cleans up the profiler implementation and updates its direct Rust dependencies. It removes unused code and dependencies, reduces repeated test and build-script plumbing, and updates dependencies in focused commits.
The main runtime improvements are the upgrade to
rustc-hash2.1.3, which provides a faster and better-finalized hash algorithm with improved string hashing for stack interning, live heap tracking, and the I/O file descriptor cache, and the upgrade torand0.9.4 plusrand_distr0.5.1, which uses the rewritten large-lambda Poisson sampler. In a local two-million-sample release benchmark, Poisson sampling improved from 121.44 ns to 33.23 ns at lambda 100 and from approximately 114 ns to 22 ns at the I/O and allocation lambdas, a 3.7–5.3x speedup. The Poisson state grows by 48 bytes per sampler, approximately 480 bytes per PHP thread (1 for NTS, n for ZTS).The
dynasmrt5.0.0 update also picks up internal AArch64 instruction-cache handling and an upstream fix for an illegal-instruction crash on Apple AArch64, directly covering the generated PHP frameless-call trampolines.Remaining updates are maintenance and compatibility upgrades; Criterion and UUID are intentionally unchanged because their latest versions would respectively conflict with
criterion-perf-eventsand add anothergetrandomgeneration without improving profiler code.Reviewer checklist