Skip to content

some refactoring of io formatter internals#2943

Merged
lerno merged 1 commit intoc3lang:masterfrom
ManuLinares:formatter
Feb 19, 2026
Merged

some refactoring of io formatter internals#2943
lerno merged 1 commit intoc3lang:masterfrom
ManuLinares:formatter

Conversation

@ManuLinares
Copy link
Copy Markdown
Member

extracted logic for hex-buffers (%h), string-padding (%s), hex-floats (%a), and collection printing into helper functions.


I did some testing:

Function Before After Change
std::io::out_str 1747 1227 -29.8%
std::io::vprintf 1441 1146 -20.5%
std::io::floatformat 2012 1603 -20.3%
std::io::floatformat_hex 0 496 New
Total 5200 4472 -14.0%
Opt Level Before (ms) After (ms) Difference
O0 63.9 ± 1.6 62.8 ± 1.6 -1.7%
O1 19.2 ± 0.7 18.1 ± 0.7 -5.7%
O2 17.6 ± 0.7 18.2 ± 0.8 +3.4%
O3 17.4 ± 0.6 17.1 ± 0.8 -1.7%
O4 17.2 ± 0.7 17.7 ± 0.7 +2.9%
O5 18.5 ± 0.7 18.2 ± 0.7 -1.6%
Os 17.9 ± 0.7 18.7 ± 0.7 +4.5%
Oz 17.9 ± 0.8 17.8 ± 0.6 -0.6%
  • O0/O1: Noticeably faster
  • O2/O4/Os: Slightly slower, maybe due to inlining decisions or function call overhead trade-offs.
  • O3/O5/Oz: Roughly the same or slightly faster.

I know I probably shouldn't be over-optimizing but oh well

extracted logic for hex-buffers (%h), string-padding (%s), hex-floats
(%a), and collection printing into helper functions.
@lerno lerno merged commit 7ae4c5a into c3lang:master Feb 19, 2026
23 checks passed
@lerno
Copy link
Copy Markdown
Collaborator

lerno commented Feb 19, 2026

Thank you!

@ManuLinares ManuLinares deleted the formatter branch February 19, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants