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

parking_lot mutex is slower than standard library #6317

Open
tsxiaofang opened this issue Jan 31, 2024 · 2 comments
Open

parking_lot mutex is slower than standard library #6317

tsxiaofang opened this issue Jan 31, 2024 · 2 comments
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request.

Comments

@tsxiaofang
Copy link

I also found this issue during performance testing, and I think it's best to disable parking_lot feature by default.
Amanieu/parking_lot#338

@tsxiaofang tsxiaofang added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. labels Jan 31, 2024
@carllerche
Copy link
Member

carllerche commented Feb 6, 2024

Thanks for the report. This is interesting. I think before making a decision on what to do with this, we need more data. How much does this impact Tokio in practice?

Assuming the issue does impact Tokio, we have a few options. Technically, we don't have to actually use the parking lot mutexes when the feature is enabled. It looks like the issue only impacts some platforms. One option would be to conditionally compile using the "best" mutex based on the platform. If some end users want strict control over which mutex implementation Tokio uses, we could provide cfg flags for the end application to use. E.g. --cfg tokio_force_parking_lot_mutex (or something).

This is just off the top of my head. I'm eager to learn what others think as well.

@tsxiaofang
Copy link
Author

Yes, my current approach is to disable the default features and add the necessary features myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request.
Projects
None yet
Development

No branches or pull requests

2 participants