Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common: Remove dependency on cpp-optparse (Only for FEXLoader) #4070

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Sonicadvance1
Copy link
Member

Doesn't remove it from the full project since three tools still use it.

FEXLoader argument loader is fairly special since we have a generator tied to it. This generator lets us have some niceties where everything ends up being a string literal without any sort of dynamic requirements.

cpp-optparse has a systemic issue where it makes deep copies of /everything/ all the time. This means it has huge runtime costs and huge stack usage (4992 bytes). The new implementation uses 608 bytes of stack space (plus 640 if it actually parses a strenum).

When profiling cpp-optparse with FEXLoader's argument it takes ~2,039,307 ns to parse the arguments! As a direct comparison this new implementation takes ~56,885 ns. Both sides not getting passed /any/ arguments, really shows how spicy this library is.

Doesn't remove it from the full project since three tools still use it.

FEXLoader argument loader is fairly special since we have a generator
tied to it. This generator lets us have some niceties where everything
ends up being a string literal without any sort of dynamic requirements.

cpp-optparse has a systemic issue where it makes deep copies of
/everything/ all the time. This means it has huge runtime costs and huge
stack usage (4992 bytes). The new implementation uses 608 bytes of stack
space (plus 640 if it actually parses a strenum).

When profiling cpp-optparse with FEXLoader's argument it takes ~2,039,307 ns to parse the arguments!
As a direct comparison this new implementation takes ~56,885 ns.
Both sides not getting passed /any/ arguments, really shows how spicy
this library is.
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.

1 participant