-
Notifications
You must be signed in to change notification settings - Fork 776
removes unused memory allocation in the registration #436
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
Conversation
|
Isn't this PR moving an allocation from heap to stack? I mean, the performance cost shouldn't be around the same? |
|
should be less expensive since the compiler can optimize everything, while in the other case we have to make a dynamic allocation. |
|
I try to avoid creating large arrays on the stack, because it could lead to problems with the maximum stack size. |
|
I think there should be no problems with allocating on stack such a structure since it is not really big: |
|
What about putting it in the registration class as mutable so the user can decide where to allocate it? :) |
|
Right now all the variables in the registration class are only accessed reading from the methods, so you are able to run multiple calls in parallel. If you make it a member, you have to use a mutex to protect it. |
|
I agree 100% with you, but I think it would be nice to be able to decide how to allocate it. I like the second solution you proposed (pointer). |
|
Allocating 848KB on stack is definitely not OK. MSVC default stack size is 1MB. I agree allocating 848KB 30 times per second is not optimal. But I don't think registration is performance bottleneck right now. |
|
So what about the pointer solution like with the bigdepth frame? |
|
I guess the solution is changing the interface to let user provide the intermediate data structure. |
|
I will do a pull request and then we can discuss about it |
|
Is there any use for |
|
Probably not, but In my opinion its nice to have the user decide it. |
|
Closing in favor of #441. |
I think its quite useless and expensive to allocate memory at every registration step.