opm-grid icon indicating copy to clipboard operation
opm-grid copied to clipboard

Return geometry by value (alternative 3)

Open SoilRos opened this issue 5 months ago • 4 comments

In this PR, the idea is that the geometry holds all the corners of the cell. This because in most of the cases, the geometry is constructed in place and the compiler theoretically could see through the things that are actually needed and only generate code for that. In other words, it would avoid making the copy if those values are not used.

Here is a benchmark for that hypothesis: https://quick-bench.com/q/IPXA-MuhVrdQ_9DSbgbcAyRW9ek

  • Indeed, this seems to be the case in GCC and there is no difference between storing the values or the pointers to the values.

8ek-EyAlGhyT2wGlEONCBPsEi3g

  • Sadly, the picture changes for Clang and storing the values is 5 times more expensive even if only the center of the geometry is being used.

IPXA-MuhVrdQ_9DSbgbcAyRW9ek

Note that this PR is based on #885 which fixes all the lifetime issues of the geometry objects.

SoilRos avatar Jul 04 '25 13:07 SoilRos

jenkjns build this please

blattms avatar Jul 09 '25 12:07 blattms

jenkins build this please

blattms avatar Jul 09 '25 12:07 blattms

jenkins build this serial please

SoilRos avatar Jul 31 '25 14:07 SoilRos

jenkins build this serial please

SoilRos avatar Aug 01 '25 10:08 SoilRos