vkd3d: Allocate temporary arrays on the stack in d3d12_command_list_update_push_descriptors().
Merge request reports
Activity
Maybe it's already clear, but generally speaking the philosophy here is to avoid using the heap when the stack is good enough. It makes the code shorter, control flow simpler and we avoid potentially taking a global mutex inside the allocator. Also, currently failure is silently ignored, there is not even an error message.
Maybe it's already clear, but generally speaking the philosophy here is to avoid using the heap when the stack is good enough.
Is that primarily a performance consideration? Do you happen to have performance data? Also, if this is performance sensitive, should we be using something like wined3d_bit_scan() to iterate over the dirty mask?
Is that primarily a performance consideration? Do you happen to have performance data? Also, if this is performance sensitive, should we be using something like wined3d_bit_scan() to iterate over the dirty mask?
No, it's not primarily a performance consideration. Well, in general I expect stack allocation and deallocation to be faster than heap allocation and deallocation, but I guess that the conditions under which the different matters in practice are not that common.
My main motivation for preferring using the stack instead of the heap when possible (i.e., for sufficiently small objects whose lifetime coincides with a stack frame lifetime) is that allocation is assumed to never fail, so you have simpler code and fewer exceptional code paths to maintain (and I argue that we were bitten by this in this specific case). In addition that is likely to give a non-negative, even if often zero, performance gain.
I haven't done any performance measurement here.
added 9 commits
-
b55eb4ae...ae0faf45 - 8 commits from branch
wine:master
- a876e0b1 - vkd3d: Allocate temporary arrays on the stack in d3d12_command_list_update_push_descriptors().
-
b55eb4ae...ae0faf45 - 8 commits from branch