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

[Perf] Downgrade a write guard on Process to read #2568

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

ljedrz
Copy link
Collaborator

@ljedrz ljedrz commented Oct 28, 2024

Moved from ProvableHQ#19.

The reasoning is that there is no benefit to holding a write guard here, as in addition to keeping the object frozen, it prohibits any potential readers from accessing it during finalization; a read guard in its place still won't allow the process to be modified for the entire duration of the atomic batch, but it will allow other potential concurrent readers in the meantime. Unless the state of the process (or any of its contents) during finalization should not be visible to anyone else or should be considered outright invalid until it concludes, a read guard is the more performant choice.

I haven't been able to measure the impact of this change locally, but I'm confident it would make a difference in networks involving more traffic.

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.

2 participants