SIMD (glam) slower than scalar version

⚓ Rust    📅 2025-05-01    👤 surdeus    👁️ 5      

surdeus

Warning

This post was published 111 days ago. The information described in this article may have changed.

I'm writing a path tracer and wanted to replace my own (scalar) math functionality withglam, because it uses SIMD. In dev mode (with opt-level = 3), the glam version is significantly faster than my own. However, once I switch to my release profile (lto = "fat", codegen-units = 1), the glam version suddenly becomes slower than my math implementation.

The following times were recorded for the cornell_box example on a Linux desktop, but the issue also remains on a Windows desktop

main glam
dev 94.05 s 74.74 s
release 53.85 s 67.05 s

My code can be found here. The main branch contains my math implementation, while the glam branch uses glam.

Does anybody know what might cause this or could point me in the right direction for debugging/profiling this?

1 post - 1 participant

Read full topic

🏷️ rust_feed