Chess engine is faster with debug-assertions = true

⚓ Rust    📅 2026-02-11    👤 surdeus    👁️ 1      

surdeus

I just updated the GUI for latest Xilem, and did again a few performance tests.

GitHub - StefanSalewski/xilem-chess: First Xilem GUI for the tiny salewski chess engine

With

[profile.release]
debug-assertions = true

the performance increase is about 20%.

Some months ago, we had the assumption that the debug_assert!() statements might give the compiler invariants, which might improve performance, see Funny random performance changes

But using just assert!() instead of debug_assert!() does give no performance gain. And I can even uncomment all the debug_assert!() calls in engine.rs, and get still the performance gain with use of debug-assertions = true.

Well, this is for a 64 bit x86 Linux box -- it is some funny magic.

I also tried LTO or codegen-units=1 with debug-assertions = false, but that has no significant effect on performance.

4 posts - 4 participants

Read full topic

🏷️ Rust_feed