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

walk: Use unbounded channels #1414

Closed
wants to merge 3 commits into from
Closed

Commits on Nov 2, 2023

  1. walk: Use unbounded channels

    We originally switched to bounded channels for backpressure to fix sharkdp#918.
    However, bounded channels have a significant initialization overhead as
    they pre-allocate a fixed-size buffer for the messages.
    
    This implementation uses a different backpressure strategy: each thread
    gets a limited-size pool of WorkerResults.  When the size limit is hit,
    the sender thread has to wait for the receiver thread to handle a result
    from that pool and recycle it.
    
    Inspired by [snmalloc], results are recycled by sending the boxed result
    over a channel back to the thread that allocated it.  By allocating and
    freeing each WorkerResult from the same thread, allocator contention is
    reduced dramatically.  And since we now pass results by pointer instead
    of by value, message passing overhead is reduced as well.
    
    Fixes sharkdp#1408.
    
    [snmalloc]: https://github.com/microsoft/snmalloc
    tavianator committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    d588971 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    46967b8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    346afd1 View commit details
    Browse the repository at this point in the history