Skip to content

made nanoprintf context static to reduce call overhead and size#709

Open
ZERICO2005 wants to merge 1 commit intomasterfrom
static_global_printf
Open

made nanoprintf context static to reduce call overhead and size#709
ZERICO2005 wants to merge 1 commit intomasterfrom
static_global_printf

Conversation

@ZERICO2005
Copy link
Contributor

@ZERICO2005 ZERICO2005 commented Feb 24, 2026

Made npf_cnt_putc_ctx_t pc_cnt static in npf_vpprintf, moving them off of the stack frame. This changes frameset from 145 to 138. Call overhead was also reduced since NPF_PUTC(VAL) now calls a 1 argument function instead of a 2 argument function. Overall this saves 242 bytes with Clang 17 codegen.

This optimization can be controlled via the NANOPRINTF_STATIC_GLOBALS macro I have added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant