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

Add Iter #24

Merged
merged 3 commits into from
Jan 22, 2021
Merged

Add Iter #24

merged 3 commits into from
Jan 22, 2021

Conversation

Kestrer
Copy link
Contributor

@Kestrer Kestrer commented Jan 20, 2021

Now the values inside the thread-local can be accessed concurrently by other threads.

There is a slight performance impact; get now takes 2.7ns instead of 2.5, and insert takes 45ns instead of 42.

src/lib.rs Outdated Show resolved Hide resolved
@Kestrer
Copy link
Contributor Author

Kestrer commented Jan 21, 2021

Experiementally I have added a check so that on rustc versions < 1.36.0 it uses an Option but on rustc versions >= 1.36.0 it uses MaybeUninit. Surprisingly performance is entirely unaffected, although that may just be because the benchmarks we ran were able to perform the null-pointer optimization before, and so there wasn't a cost to using an Option.

@BurntSushi
Copy link
Contributor

I wouldn't pin it. It's a little bit of a pain, but users who still need to support such an old version of Rust can pin thread_local themselves in their Cargo.lock file.

I plan to bump the MSRV of regex to 1.41.1 soon anyway. The existing 1.28 MSRV is ancient. The only reason why it's still that ild is that I haven't had a chance to go through the upgrade process.

build.rs Outdated Show resolved Hide resolved
@Kestrer
Copy link
Contributor Author

Kestrer commented Jan 22, 2021

Ok, I've updated the MSRV to 1.36.0. This also allows us do some other nice things like update to 2018 edition, use once_cell instead of lazy_static, elide some extra lifetimes, etc.

@Amanieu Amanieu merged commit 6463a4c into Amanieu:master Jan 22, 2021
@Kestrer Kestrer deleted the iter branch January 22, 2021 22:05
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.

None yet

3 participants