-
Notifications
You must be signed in to change notification settings - Fork 11
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
Krate#moshiPref - why using typeOf
instead of class?
#31
Comments
Unfortunately there is a good reason. I go into detail on this in this talk: https://zsmb.co/talks/krate-ft-moshi/ That being said, if there are alternatives to |
Thank you very much for the explanation and the link to your talk - very helpful. As far as I'm aware there is nothing wrong that the library is doing - the first invocation of |
@zsmb13 After watching your talk and checking your slides I'm wondering whether it would be an option to bring back the old implementation that you were using before switching to We've compared both implementations and those are the results: |
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:I'm wondering: Is there any good reason to use
typeOf<T>().javaType
overT::class.java
?Lastly a screenshot of the trace proving the point that
typeOf
really takes that long:The text was updated successfully, but these errors were encountered: