Skip to content

perf: don't use mutex - #12

Merged
dmitryvk merged 9 commits into
mainfrom
opt-no-mutex
Sep 21, 2025
Merged

dmitryvk merged 9 commits into
mainfrom
opt-no-mutex

Conversation

@dmitryvk

@dmitryvk dmitryvk commented Sep 21, 2025 •

Copy link
Copy Markdown
Owner

For trivial streams, Mutex shows up in flamegraphs. We can avoid using the mutex, since streams are inherently single-threaded and it's only valid to access the emitter from within the stream's closure.

  • Make the runtime check of validity access stricter
  • Run tests under Miri since we're using unsafe now
  • Use thread-local pointer to validate shared state accesses instead of a mutex

@dmitryvk
dmitryvk merged commit 32ea0b4 into main Sep 21, 2025
4 checks passed
@dmitryvk
dmitryvk deleted the opt-no-mutex branch September 21, 2025 15:37
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