Page MenuHome

Cleanup: Slightly improve virtual array implementation consistency
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Jul 26 2022, 8:47 PM.

Details

Summary

Previously the base virtual array implementation optimized for
common cases where data is stored as spans or single values.
However, that didn't make sense when there are already
sub-classes that handle those cases specifically. Instead
implement the faster materialize methods for each base class.
Now, if the base class is reached, it means no optimizations
for avoiding virtual function call overhead are used.

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Jul 26 2022, 8:47 PM
Hans Goudey (HooglyBoogly) created this revision.

The span constness part can be committed already.

source/blender/blenlib/BLI_virtual_array.hh
165

I actually meant to do the opposite at some point: Removing the special cases from VArrayImpl and only implementing them in the corresponding subclasses. Do you see a strong reason for having everything in the base class?

source/blender/blenlib/BLI_virtual_array.hh
165

Nope! Only consistency, but I agree it would be better like you suggested. I can implement that here if you'd like

source/blender/blenlib/BLI_virtual_array.hh
165

Sounds good.

Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)
Hans Goudey (HooglyBoogly) marked 2 inline comments as done.Aug 3 2022, 2:29 AM
This revision is now accepted and ready to land.Aug 18 2022, 1:53 PM