sparse marching cubes in core lib#1687
Conversation
|
At the top of |
|
Honestly I'd rather take a 1.25x performance hit and have a separate function, than keep the #include the way it is. For the benchmark it might be worth to use Catch2's benchmark functionalities so we can run that the same way we run other unit tests. |
|
The other easy option is copying-and-pasting the code. Ironically, that's exactly what Ideally, we could figure out how to wrap this up in function call (or maybe class?). I get the sense the performance hit might be compiler specific. My main hunch is that this has to do with inlining. |
|
I know that #include is just copying code around, but there are issues with readability and maintainability that outweigh the 1.25x performance hit imho. I'd rather have a shared function and take the performance hit, then optimize later on. If you really think having the best performance is key, then let's spend time on it and:
Maybe there's a low hanging fruit the function inlining, but imho this could be due to some other optimization that the compiler is doing when the code is "copied", like moving the lambda definition outside the for loop, etc. Hard to say without profiling for hotspots really. |
Continues the migration of marching_cubes out of copyleft. (Now the only feature left in copyleft is root-finding).
This is probably not yet ready to merge. Notice that it's including
march_cube.hin the middle of the two functions inmarching_cubes.h(for dense and sparse grids respectively). I tried to pull this out properly as a function but I always get a performance hit (~1.25x).I vaguely convinced it has to do with inlining, but I'm really not sure. I don't like including this implementation like this. I guess it's marginally better than copy-pasting duplicate code in each function.
Anyone care to take a look?