sentry-java
sentry-java copied to clipboard
Improve performance of normalizeUUID function.
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