facebookarchive / Keyframes

A library for converting Adobe AE shape based animations to a data format and playing it back on Android and iOS devices.
https://facebookincubator.github.io/Keyframes/
Other
5.33k stars 302 forks source link

Documentation: Explain about decoding JSON in the background #103

Open andydroidc opened 7 years ago

andydroidc commented 7 years ago

Hey guys,

Using the Android library here. When loading large json files, I'm getting around a 2-3 second UI hang. This was obviously undesired and I narrowed down the issue to being in the deserialization of the asset from the InputStream. The way I got around the issue was by using an Rx chain and pushing the deserialization off of the UI thread while providing a Looper from a HandlerThread to the Scheduler. I'm sure this can be achieved in a similar fashion with AsyncTask if needed.

In general, the file still takes around 2 seconds to load while on a background thread. Our animation files are around 30k - 50k lines long.

subtleGradient commented 7 years ago

Yeah, in production we deserialize in the background also. We are also looking into using flat buffers or something to reduce parsing time and memory overhead. I'm not sure if there's a GitHub issue open for that yet On Wed, Jan 11, 2017 at 8:48 PM andyroidc notifications@github.com wrote:

Hey guys,

Using the Android library here. When loading large json files, I'm getting around a 2-3 second UI hang. This was obviously undesired and I narrowed down the issue to being in the deserialization of the asset from the InputStream. The way I got around the issue was by using an Rx chain and pushing the deserialization off of the UI thread while providing a Looper from a HandlerThread to the Scheduler. I'm sure this can be achieved in a similar fashion with AsyncTask if needed.

In general, the file still takes around 2 seconds to load while on a background thread. Our animation files are around 30k - 50k lines long.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/facebookincubator/Keyframes/issues/103, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAQFUB3ZZMSXohsDve0Unm60lo9LeRMks5rRYZUgaJpZM4LhSC5 .