maximkulkin / esp-ir

Library for ESP-OPEN-RTOS to send IR commands.
MIT License
19 stars 6 forks source link

inline carrier functions to reduce overhead #7

Closed Fonger closed 5 years ago

Fonger commented 5 years ago

I fork your project and create esp-ir for ESP8266_RTOS_SDK 3.2. I find inline functions critical and can help increase the stability in ESP8266_RTOS_SDK version. I think this change may help in esp-open-rtos too.

Although in esp-open-rtos, the default configuration will inline it. Just in case to provide inline keyword for the compiler because some compiler with other options won't inline these and will cause a call overhead. What's worse, when this happened, this function is not in IRAM so the overhead is significant.

In my forked library I even use __attribute__((always_inline)) inline instead of regular inline because if you use menuconfig to build in "Release" mode, the compiler is in "optimization for Size -Os " hence sometimes compiler tries to override any inline keyword, leading to worse performance compared to Debug mode.

In my forked version of ESP8266_RTOS_SDK, with this little change, my air conditioner accept the IR signal with 100% rate. (originally ~95%) without this change.

maximkulkin commented 5 years ago

Thank you for your contribution! :+1: