Possible 50% performance improvement for NSGA-II on MSVC - #616
Possible 50% performance improvement for NSGA-II on MSVC #616jonas-s-s-s wants to merge 11 commits into
Conversation
Version of a hot-path function with pre-allocated vectors, reduced CPU time spent on vector allocation approximately from 7% to 1%.
Minor 0.1% / 0.2% performance increase Switch to passing struct via function params instead of static Static is not thread-safe Add another fnds_buffer inside of nsga2.cpp
This reverts commit 5083caf.
This reverts commit 7d81225.
This reverts commit 1ecf79a.
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
pareto_dominance() is now declared inline in the public header, but its definition remains only in multi_objective.cpp. Downstream translation units therefore see an inline function with no definition and can fail to link; keep the exported non-inline API, or move the complete inline definition into the header and add an external-consumer link test.
Yeah I should probably fix this before I forget what this was about. iirc the most important thing is not using std::isnan on MSVC as it's the function that's slowing it down the most. The new functions that accept vector references as a parameter are more like a hack to gain extra 5% performance, it was the easiest way to prevent the wasteful re-allocation of this memory. |
Hello everyone,
as part of my Master's Thesis (Faculty of Applied Sciences, University of West Bohemia), I have been investigating the poor performance of pagmo2's implementation of NSGA2 when compiled with MSVC. The changes that I've made decrease the execution time by about 50% (MSVC 19.44.35217). This improvement was possible due to the inefficiency of
std::isnanin the MSVC Runtime Library.Other compilers such as (Clang and GCC) benefit mainly from the memory optimizations, decreasing the execution time by about 15%.
The main changes in this PR include:
less_than_f,greater_than_f,equal_to_fusing C++20 starship operatorpareto_dominance()fast_non_dominated_sorting_buffered()andselect_best_N_mo_buffered()Detailed explanation together with the code that was used for profiling can be found here: https://github.com/jonas-s-s-s/Pagmo-NSGA2-Improve-Test