android: gson performance

后端 未结 5 1716
滥情空心
滥情空心 2020-12-14 10:42

I am trying to use gson to do my object mapping on the android emulator.

It has been ridiculously slow when processing json data around 208 kb. I do not have any hie

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 11:06

    I have found that CREATING a Gson instance is a very expensive operation, both in terms of CPU used and memory allocated.

    Since Gson instances are thread-safe, constructing and reusing a single static instance pays off, especially if you are serializing / deserializing often.

提交回复
热议问题