Skip to content

viam: Prototype new traversal - #1037

Draft
flofriday wants to merge 1 commit into
masterfrom
feature/improve-memory-usage-lowering
Draft

viam: Prototype new traversal#1037
flofriday wants to merge 1 commit into
masterfrom
feature/improve-memory-usage-lowering

Conversation

@flofriday

Copy link
Copy Markdown
Contributor

The new traversal reduces memory footprint from 4.4G to 3.3G on my machine for running vadl check on huge.

This really is just a prototype to discuss this approach, it's drawbacks etc, the code is far from final!

@flofriday
flofriday requested a review from Jozott00 June 25, 2026 10:46
@github-actions github-actions Bot added enhancement New feature or request lcb This is LCB related iss This is ISS related hardware Related to the MiA and hardware generation labels Jun 25, 2026
The new traversal reduces memory footprint from 4.4G to 3.3G on my machine for
running vadl check on huge.
@flofriday
flofriday force-pushed the feature/improve-memory-usage-lowering branch from a7f8ec3 to 14ca9e5 Compare June 25, 2026 10:46
* @param consumer to add the inputs to.
*/
protected void collectInputs(List<Node> collection) { /* nothing to add */
protected void forEachInput(Consumer<Node> consumer) { /* nothing to add */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like a good approach to reduce memory allocations when no list is required.

Comment on lines +174 to +192
private static class FoundSignal extends RuntimeException {
@SuppressWarnings("StaticAssignmentOfThrowable")
static final FoundSignal INSTANCE = new FoundSignal();

private FoundSignal() {
super(null, null, false, false);
}
}

public final boolean containsInput(Node needle) {
try {
forEachInput(input -> {if (input.equals(needle))
throw FoundSignal.INSTANCE;
});
return false;
} catch (FoundSignal signal) {
return true;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we know the runtime performance impact of this approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request hardware Related to the MiA and hardware generation iss This is ISS related lcb This is LCB related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants