Merged
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. |
Collaborator
Author
|
@greptile |
Contributor
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
|
…l started/ended times on server and passback to clinet
Collaborator
|
@cursor review |
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.
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