Use stack instead of heap in AbstractYuyvBufferDecoder::component_indexes#114251
Use stack instead of heap in AbstractYuyvBufferDecoder::component_indexes#114251iker-sr wants to merge 1 commit intogodotengine:masterfrom
Conversation
|
Thanks for opening a pull request 🙂 Can you provide before/after benchmarks that show a performance difference? See Optimization guidelines for more information. If this PR is meant to improve things other than performance, please state so in the PR description. |
|
I would say this PR is a net improvement for 2 reasons:
Ultimately this will never make a noticeable performance difference since the code only runs when the camera feed is activated. Even if it did take a few ms, it would be hidden by the activation of the camera. That being said, I think it is important to avoid new/delete so that this code doesn't get copied and spread elsewhere since this is a dangerous pattern. Some code patterns are best to simply avoid in new code, but this is one that I think is worth removing from any place we spot it since if we accumulate a lot of new/deletes we will create a huge future headache. |
|
Looks great! The final step before merging is to squash all the commits together so that the whole PR only contains 1 big commit with all your changes. We like to merge one commit at a time to keep the git history clean and navigable. It looks like you accidentally added a merge commit on top of this while rebasing If you don't know how to do that, we have a helpful tutorial in the official documentation https://docs.godotengine.org/en/latest/community/contributing/pr_workflow.html#the-interactive-rebase |
3ce855c to
ae3ad75
Compare
Replaces the use of
new[]anddelete[]with the use of the stack, because the size is constant.