sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Improve performance of normalizeUUID function.

Open kozaxinan opened this issue 1 year ago • 1 comments

Problem Statement

normalizeUUID is called on main thread and cause 2-10 ms operation on production application.

There are low handing fruits.

DefaultTransactionPerformanceCollector.start calls transaction.getEventId().toString() twice and it basically make same operation. It uses normalizeUUID under the hood which take time.

Solution Brainstorm

Please assign transaction.getEventId().toString() to a val and dont do computation again. convert performanceDataMap to map of EventId instead of string and dont do EventId to String conversion while creating a trace.

I didnt check all usages of toString, it will be nice to check them and consider not unboxing the toString on main thread

or cache the value of toString and hashCode with lazy.

┆Issue is synchronized with this Jira Improvement by Unito

kozaxinan avatar Oct 07 '24 14:10 kozaxinan