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

[QA] Replace setOf with HashSet.add #3801

Merged
merged 4 commits into from
Oct 17, 2024
Merged

Conversation

stefanosiano
Copy link
Member

📜 Description

replaced kotlin setOf() with HashSet<>() + add() calls

setOf() was taking ~10ms to run, while instantiating an HashSet and then calling add multiple times is almost instantaneous - at least in debug builds

💡 Motivation and Context

💚 How did you test it?

Unit test

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

@stefanosiano stefanosiano changed the title Replace setOf with HashSet.add [QA] Replace setOf with HashSet.add Oct 17, 2024
@stefanosiano stefanosiano marked this pull request as ready for review October 17, 2024 11:15
Copy link
Contributor

github-actions bot commented Oct 17, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 390.57 ms 406.78 ms 16.21 ms
Size 1.70 MiB 2.35 MiB 668.15 KiB

Previous results on branch: fix/replace-setof-with-hashset

Startup times

Revision Plain With Sentry Diff
a5fea3a 396.34 ms 435.88 ms 39.54 ms

App size

Revision Plain With Sentry Diff
a5fea3a 1.70 MiB 2.35 MiB 668.15 KiB

@stefanosiano stefanosiano enabled auto-merge (squash) October 17, 2024 13:33
@@ -8,6 +8,7 @@

### Fixes

- Replace setOf with HashSet.add ([#3801](https://github.com/getsentry/sentry-java/pull/3801))
Copy link
Contributor

Choose a reason for hiding this comment

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

  • 🚫 The changelog entry seems to be part of an already released section ## 7.16.0.
    Consider moving the entry to the ## Unreleased section, please.

@stefanosiano stefanosiano merged commit 0132cdd into main Oct 17, 2024
23 of 27 checks passed
@stefanosiano stefanosiano deleted the fix/replace-setof-with-hashset branch October 17, 2024 13:42
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