Skip to content

Conversation

@saintentropy
Copy link
Contributor

@saintentropy saintentropy commented Oct 14, 2025

Purpose

DYN-9675

This PR goal is to improve throughput of the DEP_Handler function in the Dynamo VM. DEP_Handler is a function called on the hot path of graph execution multiple time for each function call within a node (ie multiple times per replication calls). This PR attempts to improve the speed of those calls and improve the memory efficiency. Specifically:

  • Remove use of LINQ FirstOrDefault usage
  • Simplify unnecessary allocation of temporary variables.

The result of the PR in one test graph (with over 2million calls to DEP_Handler) reduces the time by ~.5s or 5% of graph execution as follows:

master:
image
PR:
image

For the same test graph, the memory changes are as follows:

master:
image
PR:
image

Declarations

Check these if you believe they are true

Release Notes

VM Performance improvements

Reviewers

FYIs

Copilot AI review requested due to automatic review settings October 14, 2025 02:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes performance-critical code in the Dynamo VM by removing LINQ operations and reducing allocations in the DEP_Handler function path. The changes focus on improving execution speed and memory efficiency for graph execution scenarios with high call volumes.

  • Replaces LINQ FirstOrDefault calls with manual for loops to avoid iterator overhead
  • Eliminates unnecessary temporary variable allocations in hot path execution
  • Moves variable declarations closer to their usage to improve code clarity

@github-actions github-actions bot changed the title Remove use of LINQ in hot path for DEP_Hander calls in AssociativeGraph.cs DYN-9675: Remove use of LINQ in hot path for DEP_Hander calls in AssociativeGraph.cs Oct 14, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-9675

@saintentropy saintentropy changed the title DYN-9675: Remove use of LINQ in hot path for DEP_Hander calls in AssociativeGraph.cs DYN-9675 Remove use of LINQ in hot path for DEP_Hander calls in AssociativeGraph.cs Oct 14, 2025
@zeusongit zeusongit requested a review from a team October 14, 2025 16:17
Copy link
Contributor

@reddyashish reddyashish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Looks good with one comment.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@aparajit-pratap aparajit-pratap merged commit e246506 into DynamoDS:master Oct 22, 2025
26 of 27 checks passed
aparajit-pratap added a commit to aparajit-pratap/Dynamo that referenced this pull request Oct 22, 2025
reddyashish pushed a commit that referenced this pull request Oct 22, 2025
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.

4 participants