Implement a Native Renderer for Compiled Language Bindings - #85
Draft
parkernilson wants to merge 151 commits into
Draft
parkernilson wants to merge 151 commits into
parkernilson wants to merge 151 commits into
Conversation
added 30 commits
August 12, 2026 18:11
Documents the algorithm for Renderer::renderGraph: on-demand structural hashing folded into a single post-order recursive pass, ordered instruction batching threaded through the call stack instead of stored as Renderer member state, and root-node wrapping semantics mirroring the JS core reconciler.
Breaks the reconciliation-algorithm design spec into four tasks: data model change, test scaffolding (plain-assertion harness, no new test framework dependency), the renderGraph implementation itself, and behavior tests covering create/update/dedup/multi-root scenarios.
added 29 commits
August 31, 2026 20:25
Author
|
This is still a draft PR because there are a couple of final touches I need to finish |
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.
Fixes: #84
Summary
This PR carries changes in the c++ layer that:
struct elem::NodeReprwhich corresponds to NodeRepr.resclass elem::Renderer<FloatType>which corresponds to the Renderer in index.ts and can render graphs ofstd::shared_ptr<elem::NodeRepr>and apply instructions toelem::Runtime<FloatType>stdlibnode functions corresponding to js lib functionsAdditionally, it:
elemcli-nativeexecutable that shows a basic use case of the native renderer (and adds a compilable target that helps with IDE intellisense of header-only library)elembenchtool so that it can benchmark the performance of JS and native renderers (i.e. how long does it take to build an audio graph representation and how long does it take to render those changes to the runtime)miniaudio.hversion to support newer versions of macOSgoogletestas a submodule dependency for c++ testsGraphNode.h,Runtime.h, andValue.hUpdates to the Docs if Accepted
If these changes are accepted, I have also created a PR here with the related changes to the docs on the Elementary Website.
Proof of Concept with Swift
I put together a PoC with Swift. The basic pieces are there for end-to-end integration with Elementary, however development is still on-going.
Verification
Added automated tests for the new c++ features, and included them in the CI workflows as a new "Test" step that runs the native tests. These tests cover all the applicable test cases that the current JS renderer is subject to.
Also added benchmark testing for the JS and Native renderers. Both are extremely fast, and well within the limits of reasonable requirements. The following are the results of rendering a
cycle(440.0 + i)fori in [0..10000)with no keyed constants (i.e. the entire graph is re-rendered on each pass).us = microseconds:I plan on adding another benchmark for rendering a very large graph like 1,000 and 10,000 sine waves where each modulates the frequency of the next. I'll also include variants with keyed constants at the leaf nodes for comparison.