Skip to content

Conversation

@baolongnt
Copy link

Init of a 64k boolean array take a long time (>30ms P90) during Android app launch.

Init of a 64k boolean array take a long time (>30ms  P90) during Android app launch.
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 3, 2025

CLA Missing ID CLA Not Signed

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.18%. Comparing base (36ca9b8) to head (f5ed4cf).

Files with missing lines Patch % Lines
.../opentelemetry/api/internal/OtelEncodingUtils.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main    #7809   +/-   ##
=========================================
  Coverage     90.18%   90.18%           
- Complexity     7226     7228    +2     
=========================================
  Files           820      820           
  Lines         21790    21795    +5     
  Branches       2135     2136    +1     
=========================================
+ Hits          19651    19656    +5     
  Misses         1468     1468           
  Partials        671      671           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

/** Returns whether the given {@code char} is a valid hex character. */
public static boolean isValidBase16Character(char b) {
return VALID_HEX[b];
if (validHex == null) {
Copy link
Member

Choose a reason for hiding this comment

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

reading the volatile is going to make things slower

if we accept that multiple threads initialize the field, we can avoid this, see https://stackoverflow.com/questions/11051863/lazy-initialization-without-synchronization-or-volatile-keyword

Copy link
Author

Choose a reason for hiding this comment

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

reading the volatile is going to make things slower

if we accept that multiple threads initialize the field, we can avoid this, see https://stackoverflow.com/questions/11051863/lazy-initialization-without-synchronization-or-volatile-keyword

OK. Let me look into that.

Copy link
Member

Choose a reason for hiding this comment

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

I think you found a good solution that doesn't need locking 😄

@jkwatson
Copy link
Contributor

jkwatson commented Nov 4, 2025

@baolongnt we can't accept this unless you sign the CLA. Are you able to do so?

@baolongnt
Copy link
Author

@baolongnt we can't accept this unless you sign the CLA. Are you able to do so?

Thanks for looking at the PR. I did not think it will get any eyes till I mark as ready. I will have the CLA signed by then.

Instead of lazy init the whole array, we lazy init each values.
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