Skip to content

Comments

Use thread local to cache current thread id#11

Open
Berrysoft wants to merge 1 commit intothk1:masterfrom
Berrysoft:faster-thread-id
Open

Use thread local to cache current thread id#11
Berrysoft wants to merge 1 commit intothk1:masterfrom
Berrysoft:faster-thread-id

Conversation

@Berrysoft
Copy link

The calling to std::thread::current() clones an Arc. It is a bit heavy in a most likely single-threaded case. This PR caches the current thread id in a TLS. It should be faster than cloning an Arc.

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