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

Uses an iterator that adapts from SymbolToken to String in MacroEvaluatorAsIonReader.iterateTypeAnnotations instead of eagerly allocating a new collection. #1033

Merged

Conversation

tgregg
Copy link
Contributor

@tgregg tgregg commented Jan 16, 2025

Description of changes:
Before: 264 ms/op
After: 253 ms/op (-4.2%)

We may be able to improve performance further by reusing the iterator.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tgregg tgregg requested a review from popematt January 16, 2025 01:18
Comment on lines 160 to 165
override fun next(): String {
return tokens[index++].assumeText()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This ought to throw NoSuchElementException when index >= tokens.size (see Iterator.next), but this will instead throw ArrayIndexOutOfBoundsException.

…atorAsIonReader.iterateTypeAnnotations instead of eagerly allocating a new collection.
@tgregg tgregg force-pushed the ion-11-encoding-optimize-evaluator-annotation-iterator branch from 2041189 to ece2e55 Compare January 16, 2025 19:51
@tgregg tgregg merged commit 3242f09 into ion-11-encoding Jan 16, 2025
17 checks passed
@tgregg tgregg deleted the ion-11-encoding-optimize-evaluator-annotation-iterator branch January 16, 2025 20:16
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