Skip to content

Faster UUID Generation #3809

@lbloder

Description

@lbloder

Description

Problem Statement

UUID Strings are used heavily in our SDK and lead to a significant performance impact as reported by some of our users (e.g. #3325).

After some investigation, likely causes are:

  • Slow UUID.toString on Java 8 and below
  • String replacement to generate a SentryId from a UUID string (.replace("-", ""))

Solution proposal

In addition to making the calls to UUID generation lazy (#3770) the actual generation of the UUID String performance should be improved by:

  • Using java.util.Random instead of java.util.SecureRandom as we do not need to generate unguessable UUIDs (Random has been vendored into our SDK in [QA] Replace SecureRandom with vendored Random #3783.
  • Use a different method to get rid of - in the UUIDs as .replace uses regex under the hood which also impacts performance

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions