Skip to content

Read cached vertex serializers without acquiring the read lock - #578

Open
BonsUnleashed wants to merge 1 commit into
FiniteReality:20.1/forgefrom
BonsUnleashed:bons-furious/embeddium-serializer-lookup-snapshot
Open

BonsUnleashed wants to merge 1 commit into
FiniteReality:20.1/forgefrom
BonsUnleashed:bons-furious/embeddium-serializer-lookup-snapshot

Conversation

@BonsUnleashed

Copy link
Copy Markdown

Proposed Changes

Every vertex-format copy looks up its serializer under a read lock, even after the cache has settled. This lets a cache hit read an immutable snapshot instead. A miss still takes the existing lock and refreshes the snapshot when the cache grows; serializer creation and its write lock stay as they are. The first lookup also includes serializers added by Oculus during construction.

This is the change used in Bons and Furious since 1.0.21. Its earlier checks covered concurrent readers and a writer and returned the same serializer objects. This upstream port passes compileJava on 20.1/forge; I have not run this branch in game.

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