Repository navigation
Conversation
Waiting a fixed 50 ms after the first event added most of an edit's latency. The watcher now starts once no event has arrived for 10 ms, at most 50 ms after the first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
cknitt
force-pushed
the
ocaml-rewatch-watch-settle
branch
from
October 16, 2026 05:59
9007219 to
ce1b818
Compare
cknitt
marked this pull request as ready for review
October 16, 2026 05:59
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8873 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After the first file event of a save, OCaml rewatch's watch mode always waited 50 ms before rebuilding, to collect the rest of the burst an editor produces. That wait was most of the latency of an edit.
The watcher now starts the rebuild once no event has arrived for 10 ms, and still waits at most 50 ms after the first event. Events arriving later start another build, as before. If the system clock is set back during the wait, the wait ends.
Measured on a Linux VM, from saving a file in
tests/testsuntil its JS output contains the edit:Each save still produces exactly one rebuild. For comparison, Rust rewatch takes 115 ms and 283 ms on the same machine.
The trade-off: an editor whose save events are more than 10 ms apart, such as a format-on-save that writes the file a second time later, can now trigger a second, short rebuild instead of one.
🤖 Generated with Claude Code