Skip to content
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

Add safeguards to activateRoots and optimize render ops #41

Merged
merged 17 commits into from
Apr 25, 2024

Conversation

cannc4
Copy link
Collaborator

@cannc4 cannc4 commented Mar 29, 2024

Changes

  • Fixes the garbage collector crash
  • Fix change instruction order manually (@ncblair)
  • Remove hash table lookup from render ops (@ncblair)
  • Fix GC cutting off tails

Copy link
Contributor

@nick-thompson nick-thompson left a comment

Choose a reason for hiding this comment

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

Fantastic thanks @cannc4 @ncblair! I have a couple nitpicks inline and I mentioned on the other open PR it looks like the same commit for the root node activate() change is in both PRs, so let me know what you want to do with that. Otherwise I'm happy to merge asap

.gitignore Outdated Show resolved Hide resolved
runtime/elem/Runtime.h Show resolved Hide resolved
}
}
}

// Merge
currentRoots = active;
currentRoots.swap(active); // More efficient than assignment
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh really? I'm curious to learn about that, mind explaining?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think for the std::set it might be a bit more efficient than the assignment because it only deals with internal pointers

Copy link
Contributor

@ncblair ncblair Apr 15, 2024

Choose a reason for hiding this comment

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

I think maybe the most clear would be currentRoots = std::move(active); ? would do no copy like the call to swap but more clarity.

though, i really don't think this is a bottleneck at all. and I imagine a compiler might pick up the move call internally anyways since its at the bottom of the function

either way, active is deallocated at the end of the function call. if you really wanted to optimize with swap, active could be a member?

but imo whatever makes the code clearest here is the best. = seems fine. this function isn't called in a super tight loop or anything

thoughts @cannc4 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed @ncblair! I see, yea so swap skips the copy whereas otherwise we were using a copy-assignment, got it! I'm ok with either swap or currentRoots = std::move(active)

@cannc4 cannc4 requested a review from nick-thompson April 14, 2024 05:44
@cannc4
Copy link
Collaborator Author

cannc4 commented Apr 14, 2024

Fantastic thanks @cannc4 @ncblair! I have a couple nitpicks inline and I mentioned on the other open PR it looks like the same commit for the root node activate() change is in both PRs, so let me know what you want to do with that. Otherwise I'm happy to merge asap

It should fine to merge this one as @ncblair's changes are also included here but up to you

Copy link
Contributor

@nick-thompson nick-thompson left a comment

Choose a reason for hiding this comment

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

Sorry for the delay my friends! I just took another pass, looks great, merging now. Thank you!

@nick-thompson nick-thompson merged commit a1110fc into elemaudio:develop Apr 25, 2024
4 checks passed
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.

3 participants