Skip to content

runtime: preserve exact timer ordering - #6058

Open
davecheney wants to merge 1 commit into
tinygo-org:devfrom
davecheney:davecheney-rp2-timer-division-investigation
Open

davecheney wants to merge 1 commit into
tinygo-org:devfrom
davecheney:davecheney-rp2-timer-division-investigation

Conversation

@davecheney

Copy link
Copy Markdown
Contributor

Rounding both deadlines first discards information and adds work. The direct comparison preserves deadline order and removes division from queue insertion. Equal deadlines still keep insertion order.

Rounding both deadlines first discards information and adds work. The direct comparison preserves deadline order and removes division from queue insertion. Equal deadlines still keep insertion order.
@davecheney davecheney added this to the 0.45 milestone Oct 28, 2026
@davecheney
davecheney marked this pull request as ready for review October 28, 2026 09:26
@davecheney

Copy link
Copy Markdown
Contributor Author

This has no visible difference impact on the size tests because the existing size tests do not exercise timers, #6059 covers this.

@dgryski

dgryski commented Oct 28, 2026

Copy link
Copy Markdown
Member

Timer queue is becoming a heap. #6035. I'll make sure this change is incorporated.

0pcom added a commit to 0magnet/tinygo that referenced this pull request Oct 28, 2026
The heap kept its own copy of the deadline in timerNode.when. A timer's
deadline only changes while none of its nodes is queued, so the heap can
compare timer.when directly, like the list does after tinygo-org#6058. This drops
the copy and makes whenTicks the same as on dev again. Equal deadlines
still keep insertion order through seq.
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