Skip to content

Iteratively skip containers in Ion Text reader#535

Merged
popematt merged 2 commits intoamazon-ion:masterfrom
popematt:master
Jul 20, 2023
Merged

Iteratively skip containers in Ion Text reader#535
popematt merged 2 commits intoamazon-ion:masterfrom
popematt:master

Conversation

@popematt
Copy link
Copy Markdown
Contributor

Issue #, if available:

None.

Description of changes:

Changes skip_over_container to use iteration instead of recursion.

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 19, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.02 ⚠️

Comparison is base (68365e0) 66.83% compared to head (5c576d8) 66.82%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #535      +/-   ##
============================================
- Coverage     66.83%   66.82%   -0.02%     
+ Complexity     5393     5391       -2     
============================================
  Files           156      156              
  Lines         22734    22741       +7     
  Branches       4081     4082       +1     
============================================
+ Hits          15195    15196       +1     
- Misses         6243     6247       +4     
- Partials       1296     1298       +2     
Impacted Files Coverage Δ
...c/com/amazon/ion/impl/IonReaderTextRawTokensX.java 74.89% <100.00%> (+0.14%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines +1209 to +1210
final int CONTAINER_STACK_INITIAL_CAPACITY = 16;
final ArrayList<Integer> terminatorStack = new ArrayList<>(CONTAINER_STACK_INITIAL_CAPACITY);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's move this to the class level and just clear it upon entering this method, to avoid allocating a new one every time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought about that, but does that risk introducing thread-safety issues?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh wait, we construct a new reader instance for each input source, so it wouldn't introduce any thread safety issues that aren't already present.

@popematt popematt merged commit 3fb88a1 into amazon-ion:master Jul 20, 2023
@popematt
Copy link
Copy Markdown
Contributor Author

@0roman Please follow the Contribution Guidelines for security issues.

If you are unable to reach us that way, you can contact us privately via the email address in our Maven artifacts (ion-team@amazon.com).

@0roman
Copy link
Copy Markdown

0roman commented Jul 24, 2023

Thanks, I will reach out via ion-team@amazon.com.

@popematt
Copy link
Copy Markdown
Contributor Author

@0roman FYI, I will delete some of your comments. We are not attempting to prevent discussion, but as mentioned, it is not the proper channel for this sort of thing.

@amazon-ion amazon-ion deleted a comment from 0roman Jul 24, 2023
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.

3 participants