[ASDisplayNode] Convert isSynchronous to an Objective-C atomic BOOL. #88
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reduces lock contention, and should also fix a very rarely seen deadlock.
See #64 for details.
@Adlai-Holler -- this is a case where I think a std::atomic would probably be better if we had a convenient access pattern. If we carried this pattern to other flags, the message send overhead would definitely become significant.
Although it's in the margin (most apps spend between 8-13% of all CPU time in objc_msgSend), for a core library it's great to keep that overhead as low as practical; BOOL flags seem like a possible opportunity to do something really efficient.
I'm also wondering if we could use a bitfield or something else more packed. It's not an issue for one BOOL, but I bet we'd get significant gains out of moving all the _flags to std::atomic bitfields if they were kept within 32 bits per field. We'd be able to avoid locking the mutex in many situations we do today, which would help not just CPU time but also contention / scheduler waiting.