-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Recently we've done some tracing regarding our app start performance. What we noticed is that the very first time typeOf is invoked it takes a long time (~1 second). While we were able to eliminate those calls in our code base, we were noticing that the Moshi extension for Krate is doing it as well:
@OptIn(ExperimentalStdlibApi::class)
public inline fun <reified T : Any> Krate.moshiPref(
key: String? = null,
): KeyedKratePropertyProvider<T?> {
return moshiPrefImpl(key, typeOf<T>().javaType)
}
I'm wondering: Is there any good reason to use typeOf<T>().javaType over T::class.java?
Lastly a screenshot of the trace proving the point that typeOf really takes that long:

Metadata
Metadata
Assignees
Labels
No labels