Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finished hw04 #23

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

finished hw04 #23

wants to merge 6 commits into from

Conversation

miyanyan
Copy link

  • 运行环境 : win11, msvc2019, [email protected]
  • 时间变化 : 优化前 : 1130ms, 优化后 :150ms
  • 主要修改:
    1. 循环中的不变量挪到外面,提升了100ms左右,循环里汇编代码少了一个movss,一个mulss
    2. sqrt 改为 std::sqrt,没变化,看了下汇编代码还是sqrtss,没矢量化成功,看来矢量化成功要好多条件?
    3. 一些计算数字改为编译期常量,没变化
    4. 编译选项添加 ffast-math 和 march=native (windows 下名称不一样),提升了250ms左右,开启AVX2后提升的很明显。从这开始汇编代码看不太懂了……
    5. 结构体 AOS 改为 SOA,没变化,这里我就很奇怪了,感觉应该这里提升很大才对
    6. 先读到局部变量,再写入,提升了600ms左右!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant