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

Apply thread-local cache to InitLayer and MergingLayer #130

Merged
merged 3 commits into from
Oct 1, 2020

Conversation

Gegy
Copy link
Contributor

@Gegy Gegy commented Sep 5, 2020

Previously, we were only applying this to ParentedLayer, which would eliminate the majority of potential race conditions. This would make any race condition issue practically impossible in a vanilla context, but when adding more threads, it becomes much more likely to occur through the alternative InitLayer and MergingLayer, which were missed by accident in the original PR.

@2No2Name
Copy link
Member

Looking at the code now. Are you saying the vanilla code has race conditions?

Copy link
Member

@2No2Name 2No2Name left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the code looks good to me. I wonder how you chose the cache capacities, as they are different from vanilla, but you are not sharing the cache between threads.

@Gegy
Copy link
Contributor Author

Gegy commented Sep 10, 2020

I don't remember exactly how we ended up with these cache sizes- I recall there was the consideration of how many threads there are, but also the reduced memory overhead with this implementation in comparison to vanilla.

@2No2Name 2No2Name merged commit f917edf into CaffeineMC:1.16.x/dev Oct 1, 2020
@Gegy Gegy deleted the biome-layer-cache-fix branch October 1, 2020 17:01
Kichura added a commit to Kichura/MCWine that referenced this pull request Oct 1, 2020
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