Why is calling my asm function from Rust slower than calling it from C?
5 months ago
- #profiling
- #Rust
- #performance
- 识别出特定汇编函数cdef_filter4_pri_edged_8bpc_neon在Rust实现中比C基准慢30%
- 发现性能下降是由于Rust版本中数据加载速度较慢,这源于过多的栈数据存储
- 查明根本原因是编译器无法跨函数指针优化Rust抽象
- 通过使WithOffset结构体FFI安全并重构跨FFI边界的数据传递方式实现修复,将性能差距缩小至C版本的5%以内
- 使用samply和cargo asm等性能分析工具诊断并验证了优化效果