]> granicus.if.org Git - esp-idf/commit
gpio/driver: Sped the gpio_intr_service ISR up by 1.5 uSeconds (+-50% faster).
authorPieter du Preez <pdupreez@gmail.com>
Fri, 21 Dec 2018 14:07:51 +0000 (14:07 +0000)
committerbot <bot@espressif.com>
Wed, 13 Mar 2019 13:50:43 +0000 (13:50 +0000)
commitb8dc48ab18beac9e063fd3f193914e9b671bd803
tree7d983e3cec6b3a5585d44a7ab7ebe332ca341534
parentd34ca0b8977a8ddecd6c2b571c7cf9d8dc01aa90
gpio/driver: Sped the gpio_intr_service ISR up by 1.5 uSeconds (+-50% faster).

Removed as much branching (if statements) from the
gpio_intr_service ISR, as possible and split the while loop into
two. Also forced writing the two status*_w1tc variables only once,
instead of every time after calling the external function hooks.

The measurements below, was done using the following tools:

Toolchain version: crosstool-ng-1.22.0-80-g6c4433a
Compiler version: 5.2.0

Here follows a comparison of the gpio_intr_service ISR's
execution time, using a DS1054 oscilloscope. All the time spent
calling external functions, via the function pointers
gpio_isr_func[gpio_num].fn, were disregarded.

With OPTIMIZATION_FLAGS = -Og, 1.34 uSeconds faster:

3.22 uSec (with this patch)
4.56 uSec (with commit 71c90ac4)

100 - (100 * 4.56 / 3.22) = 42% faster

With OPTIMIZATION_FLAGS = -Os, 1.65 uSeconds faster:

2.89 uSec (with this patch)
4.54 uSec (with commit 71c90ac4)

100 - (100 * 4.54 / 2.89) = 57% faster

Signed-off-by: Konstantin Kondrashov <konstantin@espressif.com>
Merges https://github.com/espressif/esp-idf/pull/2861
components/driver/gpio.c