Simplify connection topology detection#276
Open
Sympatron wants to merge 1 commit intogoToMain:masterfrom
Open
Conversation
Disjoint set uses a kB of stack and the algorithm used is O(n²) in all cases. This uses way less stack space, is O(n) in case of a single channel and in case of one PD per channel and it also needs less flash.
Member
|
Can you please post something about failure? Like, how does your channel topology look? I know this code hasn't been touched in a while, so maybe it's broken. It's not a whole lot of code, so I can't imagine any serious change in code size with either approach. |
Contributor
Author
|
The code was fine. The problem was that my stack was not large enough. On a tiny microcontroller 1kB can be a lot. When I made the stack bigger it worked. But I still think it would be better to not use so much RAM if it is not necessary. Especially stack which can be surprising and very hard to diagnose if it goes wrong in a microcontroller (i.e. without MMU). |
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.
Disjoint set uses over 1 kB of stack and the algorithm used is
O(n²)in all cases.This uses 1kB less stack space and is
O(n)in case of a single channel and in case of one PD per channel.It also needs less flash.
The runtime complexity is not the main issue here, just a side effect. I mainly started working on this, because I got stack overflow errors in my application during setup.