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

Parser seems to spend most of its time doing type metadata lookup #32

Open
BenHetherington opened this issue Sep 24, 2023 · 0 comments
Open

Comments

@BenHetherington
Copy link

When using Citron as an SPM package, the CitronParser protocol (which includes the core parsing code) ends up in a separate module from the generated parser. I found that this led to the parser spending most of its time at runtime in Swift metadata lookup (I don't believe it's able to inline specialise the protocol and inline its code across the module boundary).

I don't still have the Instruments trace handy, but one of the examples I saw was lookup for metadata of a tuple, which seemed to be the one for yyStack.

By gratuitously adding @inlinable to CitronParser (in BenHetherington/citron@87d835c), I was able to reduce the runtime of my project's parser by about 8x (in my test, this took it from over 8 seconds to about 1 second, with the parser running on all cores).

I'm not sure if this is an appropriate solution for this project – it required making a lot of things internal to the Citron module rather than private to CitronParser – but I figured it was worth reporting the performance issue all the same!

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

No branches or pull requests

1 participant