You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
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
toCitronParser
(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 thanprivate
toCitronParser
– but I figured it was worth reporting the performance issue all the same!The text was updated successfully, but these errors were encountered: