Skip to content

Improve perfomance by replacing sscanf with strto* functions#1074

Closed
earnol wants to merge 1 commit into
leethomason:masterfrom
earnol:master
Closed

Improve perfomance by replacing sscanf with strto* functions#1074
earnol wants to merge 1 commit into
leethomason:masterfrom
earnol:master

Conversation

@earnol
Copy link
Copy Markdown

@earnol earnol commented May 7, 2026

*scanf functions are less efficient compared to specialized strto* functions. The replacement allowed to use shorter code and achieve ~42% parsing performance boost from 2534ms to 1478ms on dream.xml example on average with -O2.
This patch also addresses findings from bugprone-misplaced-widening-cast checker when run on library code.

*scanf functions are less efficient compared to
specialized strto*. The replacement allowed to use
shorter code and achive ~42% parsing performance boost
from 2534ms to 1478ms on dream.xml example on average.
This patch also addresses findings from
bugprone-misplaced-widening-cast checker when run on library code.
@earnol
Copy link
Copy Markdown
Author

earnol commented May 11, 2026

Ping!

@earnol
Copy link
Copy Markdown
Author

earnol commented May 14, 2026

And ping again.

@earnol
Copy link
Copy Markdown
Author

earnol commented May 20, 2026

And ping! Still waiting for the review!

@leethomason
Copy link
Copy Markdown
Owner

Much too modern code. TinyXML-2 is roughly C++ 99 and doesn't even use std / STL. It isn't worth changing that for a performance gain.

@earnol
Copy link
Copy Markdown
Author

earnol commented May 27, 2026

Well. Performance gain can be achieved within C++ 99 too. Not that elegant, but still can be done with macros. Do you want me to update PR?

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