hw04_finished, but why run with vs much slower? #16
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.
Mingw32, cpu i7-9750H
//do nothing
Initial energy: -8.571526
Final energy: -8.511777
Time elapsed: 5386 ms
//just --fast-math -march=native -O3
Time elapsed: 3347 ms
//substitute sqrt with std::sqrt
Time elapsed: 2387 ms
//extract G * dt and eps * eps
Initial energy: -8.571528
Final energy: -8.511692
Time elapsed: 725 ms
//extract inv_d2
Time elapsed: 559 ms
// / 2 -> * 0.5 (almost nothing)
Time elapsed: 533 ms
//unroll 4 稳定慢了20ms(也可能是没效果) -划掉
//struct 对齐到8个float 反向优化200ms -划掉
//改array 没变化
//SOA
Time elapsed: 140 ms
未优化
vs debug 4221ms release 1130ms
优化后
vs debug 9200ms release 2700ms ??? 我辛辛苦苦半天优化怎么换到vs还慢了一倍多