Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试优化使用 xtensa LX6 微处理器的 esp32 上的代码,我想知道用于读取或写入特殊寄存器的 wsr 和 rsr 指令的成本。
首先,只有在你进行了分析之后才进行优化,并得出这是你的瓶颈的结论。
在极少数情况下(例如访问寄存器的函数),优化编译器生成的代码可能是个好主意,但通常这不是瓶颈所在。
通常,在优化编译器生成的代码时:
即使您设法进行了优化,在选择优化版本之前也要考虑可读性、可移植性、维护等。