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

[ASTextNode] Fix an race condition on ASTextKitAttributes #819

Closed

Conversation

hebertialmeida
Copy link
Contributor

This problem was reported on #552 by @Kaspik some time ago.

Running the project with thread sanitizers enable show a bunch of errors due to a race condition on ASTextKitAttributes, I spent some time looking at that and I found out that the race condition is happening on ASTextNode when rendererForAttributes tries to get and set the object to cache.

This fixes the problem for me, I don't see any downsides to this implementation but of course, I would like to hear from your guys.

This could be false impressions, but I've noticed some performance improvement while rendering my app feed that has couple textNodes and I tried to measure that.

This is the average time (6 loads) to load a heavy cell with this code change:
with: 0.119627775
without: 0.141625549

@CLAassistant
Copy link

CLAassistant commented Mar 5, 2018

CLA assistant check
All committers have signed the CLA.

@Adlai-Holler
Copy link
Member

@hebertialmeida This is a really reasonable fix that I didn't see before building #830. Despite the nice perf win you achieved, I think my fix is more targeted to the core issue – the unsafety of the ASTextKitAttributes struct.

@hebertialmeida
Copy link
Contributor Author

@Adlai-Holler Alright! so, should I close this one?

@Adlai-Holler
Copy link
Member

@hebertialmeida Yes please. Sorry about that!

@hebertialmeida
Copy link
Contributor Author

No problem! Any idea when will #830 will get merged?

@Adlai-Holler
Copy link
Member

@hebertialmeida Merged!

@hebertialmeida hebertialmeida deleted the HARaceCondition branch March 12, 2018 17:50
@hebertialmeida
Copy link
Contributor Author

Perfect! Thanks...

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.

3 participants