Remove altogether the Vector cache for MVPosition and Euler classes. #716
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes altogether the Vector cache for MVPosition and Euler classes that was introduced
in #258 and modified in #680.
The cache was implemented using a thread_local storage, which means that the cache shouldn't be shared among different threads. This was unfortunately the case, since the MeasTable class creates some global objects that include instances of MVPosition derived classes. This causes
undefined behaviours, since the constructors for thread_local variables are called before the destructors for the global variables, according to the C++11 standard. Running the tTableMeasures test triggered in fact a segmentation fault due to this and valgrind reports those errors.
The original cache implementation didn't clean the memory, so the problem was simply hidden. The original idea of the cache was to improve the performance, achieving around 5x boost when objects are constantly being allocated and deleted. However, in a quick test I replaced Vector with std::array<double,3> (C++11) and I got a ~70x performance boost without any extra cache, so that might be a better route to explore, rather than a cache that is difficult to get it right.