cb
07/29/2022, 9:33 AMnavigate()
, therefore performance is important. Most of these Args
classes we have are @Serializable object MyScreenArgs: ArgsInterface
, and some are data classes if they contain some inner values.
We've seen that creating a serializer()
for the object
classes is extremely slow:
7,137ns benchmarkDataClassContentViewArgsToBundle
69,204ns benchmarkObjectContentViewArgsToBundle
5,301ns benchmarkDataClassBundleToContentViewArgs
67,981ns benchmarkObjectBundleToContentViewArgs
(tests using AndroidX Microbenchmark on a Google Pixel 1)
It doesn't matter if we use the reflection or non-reflection versions of serializer()
, they're both very similar in terms of time. In fact, the generated serializer is usually slightly slower to retrieve for some reason.
I've profiled our tests, and 90% of the time is spent retrieving the serializer()
, the conversion to/from JSON is around 3ms for all benchmarks. Anyone know why the object serializer could be so slow?mbonnin
07/30/2022, 12:05 PMmbonnin
07/30/2022, 12:06 PMcb
08/02/2022, 11:13 AMcb
08/02/2022, 12:56 PM