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

Rewrite SegQueue for better performance #291

Merged
merged 3 commits into from Jan 21, 2019
Merged

Rewrite SegQueue for better performance #291

merged 3 commits into from Jan 21, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jan 17, 2019

The implementation of SegQueue<T> is completely rewritten and is based on https://github.com/stjepang/queue, which provides notably better performance. This one doesn't use crossbeam-epoch for memory reclamation, which means we don't have to pin and execute a full fence on every operation.

For more information on how this queue works, see:

One new addition in this PR is the SegQueue::len() method.

Benchmarks before:

unbounded_mpmc            Rust segqueue     0.336 sec
unbounded_mpsc            Rust segqueue     0.261 sec
unbounded_seq             Rust segqueue     0.306 sec
unbounded_spsc            Rust segqueue     0.201 sec

Benchmarks after:

unbounded_mpmc            Rust segqueue     0.186 sec
unbounded_mpsc            Rust segqueue     0.206 sec
unbounded_seq             Rust segqueue     0.241 sec
unbounded_spsc            Rust segqueue     0.115 sec

@ghost
Copy link
Author

ghost commented Jan 21, 2019

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 21, 2019

Merge conflict (retrying...)

1 similar comment
@bors
Copy link
Contributor

bors bot commented Jan 21, 2019

Merge conflict (retrying...)

@bors
Copy link
Contributor

bors bot commented Jan 21, 2019

Canceled

@ghost
Copy link
Author

ghost commented Jan 21, 2019

bors r+

bors bot added a commit that referenced this pull request Jan 21, 2019
291: Rewrite SegQueue for better performance r=stjepang a=stjepang

The implementation of `SegQueue<T>` is completely rewritten and is based on https://github.com/stjepang/queue, which provides notably better performance. This one doesn't use `crossbeam-epoch` for memory reclamation, which means we don't have to pin and execute a full fence on every operation.

For more information on how this queue works, see:
* https://github.com/stjepang/queue/issues/1
* #279 (comment)

One new addition in this PR is the `SegQueue::len()` method.

Benchmarks before:

```
unbounded_mpmc            Rust segqueue     0.336 sec
unbounded_mpsc            Rust segqueue     0.261 sec
unbounded_seq             Rust segqueue     0.306 sec
unbounded_spsc            Rust segqueue     0.201 sec
```

Benchmarks after:

```
unbounded_mpmc            Rust segqueue     0.186 sec
unbounded_mpsc            Rust segqueue     0.206 sec
unbounded_seq             Rust segqueue     0.241 sec
unbounded_spsc            Rust segqueue     0.115 sec
```

Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jan 21, 2019

Build succeeded

@bors bors bot merged commit 40d8812 into crossbeam-rs:master Jan 21, 2019
@ghost ghost deleted the segqueue-new-impl branch January 21, 2019 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

0 participants