Skip to content

Refactors the nm hoister to avoid tree structures #6852

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Jul 19, 2025

Note: This is mostly an experiment, I'm not sure I want to really merge it right about now.

What's the problem this PR addresses?

I'm playing with porting the nm hoister, and the tree data structure can make things impractical. I'm also interested into avoiding recursive data structures to make the memory access faster.

How did you fix it?

This diff attempts to "flatten" the tree by turning recursive data structures into a flat array we reference through cell indices. So for example instead of:

interface Node {
  children: Array<Node>;
}

We instead have:

interface Node {
  children: Array<number>;
}

interface Tree {
  nodes: Array<Node>;
  root: number;
}

It makes some things harder, but other things slightly easier.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

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.

1 participant