Skip to content

Conversation

@ahoppen
Copy link
Member

@ahoppen ahoppen commented Feb 6, 2023

Creating arrays for consume(ifAny:) and friends incurs memory allocations and reference counting costs. Stamp out copies of consume(if:) for up to three different kinds and start using RawTokenKindSubset if more kinds need to be checked.

This improves performance of parsing MovieSwiftUI by 5%.

rdar://103774645

@ahoppen ahoppen requested a review from rintaro February 6, 2023 11:23
@ahoppen
Copy link
Member Author

ahoppen commented Feb 6, 2023

@swift-ci Please test

protocol P { }
""",
substructure: Syntax(TokenSyntax.identifier("rethrows")),
substructure: Syntax(TokenSyntax.keyword(.rethrows)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, what changed the behavior?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that was because I forgot to check remapping in consume(if:). Fixed now.

Creating arrays for `consume(ifAny:)` and friends incurs memory allocations and reference counting costs. Stamp out copies of `consume(if:)` for up to three different kinds and start using `RawTokenKindSubset` if more kinds need to be checked.

This improves performance of parsing MovieSwiftUI by 5%.

rdar://103774645
@ahoppen
Copy link
Member Author

ahoppen commented Feb 7, 2023

@swift-ci Please test

1 similar comment
@ahoppen
Copy link
Member Author

ahoppen commented Feb 8, 2023

@swift-ci Please test

@ahoppen ahoppen merged commit f6ba4aa into swiftlang:main Feb 8, 2023
@ahoppen ahoppen deleted the ahoppen/no-arrays branch February 8, 2023 19:49
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