-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(terminal): start precision #3078
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
Conversation
Replace Date.now() with performance.now() for timing measurements in the executor to provide sub-millisecond precision. This fixes timing discrepancies with fast-executing blocks like the start block where millisecond precision was insufficient. Changes: - block-executor.ts: Use performance.now() for block execution timing - engine.ts: Use performance.now() for overall execution timing Co-authored-by: emir <emir@simstudio.ai>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@greptile |
Greptile OverviewGreptile SummaryThis PR improves timing precision in block execution by replacing Key Changes:
Implementation Details:
Impact: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Engine as ExecutionEngine
participant BlockExec as BlockExecutor
participant Handler as BlockHandler
Client->>Engine: run(triggerBlockId?)
Note over Engine: startTime = performance.now()
Engine->>Engine: initializeQueue()
loop While has work
Engine->>Engine: processQueue()
Engine->>Engine: executeNodeAsync(nodeId)
Engine->>BlockExec: execute(ctx, node, block)
Note over BlockExec: startTime = performance.now()
BlockExec->>BlockExec: resolveInputs()
BlockExec->>Handler: execute(ctx, block, inputs)
Handler-->>BlockExec: output
Note over BlockExec: duration = performance.now() - startTime
BlockExec->>BlockExec: Update blockLog with duration
BlockExec-->>Engine: NormalizedBlockOutput
Engine->>Engine: handleNodeCompletion()
end
Note over Engine: endTime = performance.now()<br/>duration = endTime - startTime<br/>metadata.endTime = new Date().toISOString()
Engine-->>Client: ExecutionResult with precise duration
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, no comments
…l started/ended times on server and passback to clinet
|
@cursor review |
Summary
Addresses a timing discrepancy where fast-executing blocks, particularly the "start" block, would often report 0ms or inconsistent durations due to the millisecond precision of
Date.now(). This PR replacesDate.now()withperformance.now()for all execution timing measurements in the block executor and engine, providing sub-millisecond precision for accurate duration tracking.Type of Change
Testing
The changes were verified by:
Reviewers should focus on ensuring that the switch to
performance.now()does not introduce any unexpected side effects in timing calculations or logging, particularly regarding theendTimewhich now usesnew Date().toISOString()for the timestamp whileperformance.now()is used for duration calculation.Checklist
Screenshots/Videos