Commit 0a39be6
fix(progmem): use __builtin_memcpy to eliminate function call overhead
Replace fl::memcpy with __builtin_memcpy in FL_PGM_READ_* macros.
The fl::memcpy wrapper lives in a separate translation unit, preventing
the compiler from inlining it. This adds unnecessary function call
overhead on platforms using null_progmem.h (ESP32, ARM, etc.) where
these macros are called 3x per LED in the gamma correction hot path.
__builtin_memcpy is a compiler intrinsic that GCC/Clang will inline to
a single load instruction for small constant sizes (1, 2, 4 bytes),
maintaining strict aliasing correctness while eliminating the overhead.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent ac59596 commit 0a39be6
1 file changed
+5
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | | - | |
23 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
0 commit comments