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

New sample collector core (Pf2c) #45

Merged
merged 12 commits into from
Feb 25, 2025
Merged

New sample collector core (Pf2c) #45

merged 12 commits into from
Feb 25, 2025

Conversation

osyoyu
Copy link
Owner

@osyoyu osyoyu commented Feb 24, 2025

This branch experiments with a new sample collector implemented in C.
The goal is to reimplement the sample collector, which is currently written in Rust. The committed version still lacks many features from the original implementation.

Why reimplement?

  • The original implementation's quality is not necessarily high.
    • It overuses mutexes/rwlocks.
      • And it does not employ proper AtomicBool synchronization where it should.
    • Deadlocks occur under certain conditions. Which is a big problem.
    • SignalScheduler's installation procedure is super messy.
  • Rust issues
    • There is no rustc in most environments, especially in containers.
      • rb-sys does automatically download rustc and cargo on gem install, however that consumes a lot of time, and compilation is still slow.
    • Tons of glue code is required bridging Rust and C interfaces (especially ruby.h macros).

Of course I can improve these problems one by one, but given that C is the lingua franca of the Ruby community, I'd guessed that trying C wouldn't be that bad. And it wasn't (at least for now).

How to use

As pf2c still lacks many features, it is gated behind conditional compilation. Users must run gem install with the environment variable PF2_PF2C=1. This will disable the original Pf2, and in turn expose the Pf2c constant to Ruby.

@osyoyu osyoyu changed the title New sample collector written in C (Pf2c) New sample collector core (Pf2c) Feb 25, 2025
@osyoyu osyoyu merged commit cbd64fe into main Feb 25, 2025
0 of 6 checks passed
@osyoyu osyoyu deleted the pf2c branch March 8, 2025 08:11
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