Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5075

General • Re: Pico computations performance settings and tuning

$
0
0
Sometimes moving performance sensitive code into SRAM rather than flash RAM helps. The XIP cache is small and only 2-way set associative so its easy for code or data that will be needed soon to be evicted. To force code into SRAM, there is the __not_in_flash_func macro. For example: https://github.com/raspberrypi/pico-sdk ... _spi/spi.c

You also have some constants that might be loaded from flash RAM and thus cause a cache miss:

Code:

  static const double_t a0=0.005943;  static const double_t a1=-0.007193;  static const double_t a2=0.005943;  static const double_t b1=1.9055333;  static const double_t b2=-0.9102498;
A simple way to have them backed by SRAM would be to remove the const qualifier:

Code:

  static double_t a0=0.005943;  static double_t a1=-0.007193;  static double_t a2=0.005943;  static double_t b1=1.9055333;  static double_t b2=-0.9102498;
I all of your code and data fits in XIP cache then this might not make a difference but it's relatively easy to try.

Statistics: Posted by alastairpatrick — Sat Feb 03, 2024 1:14 am



Viewing all articles
Browse latest Browse all 5075

Trending Articles