openvdb
openvdb copied to clipboard
ValueAccessor Buffer Cache
This is a proof of concept PR following on from #1426 but instead focusing on the ValueAccessors. This PR only updates ValueAccessor3 which is used by the default set of registered VDB Trees configurations.
I've updated vdb_print with this PR with the below tests. Tested on a M1:
Test 1 (Volume Advect) Before: 1 minute, 35 seconds and 860.3 milliseconds (95860.3ms) After: 1 minute, 28 seconds and 372.2 milliseconds (88372.2ms) 8% Faster
Test 2 (Volume To Mesh) Before: 872.2 milliseconds After: 840.7 milliseconds 4% Faster
Test 3 (Fast Sweeping) Before: 32 seconds and 328.6 milliseconds (32328.6ms) After: 28 seconds and 859.0 milliseconds (28859.0ms) 11% Faster
Things oustanding:
- I took the shortest path to success here with C++17 constexpr. If we want to do a 9.X release we'd need to support it without.
- I only updated ValueAccessor3. The rest need doing but this is trivial.
- This changes their ABI but should actually be backwards compatible as I'm only appending to the member set.
- This currently stores a ptr to the ValueType on the accessor. This obviously doesn't work for bool/ValueMasks (hence the constexpr if's) but they don't suffer from the delay loading API anyway. But we ideally want some better/more specific criteria here to support more custom types.