Open LuigiPapino opened 8 years ago
I confirm what LuigiPapino says, the issue seems present since android Lollipop.
I think the issue isn't that LoganSquare is slow, but that Android has maybe increased reflection performance. I can't know for sure, though!
Also keep in mind the implementation of String and the underlying char[] was optimized in api 23 which could further reduce differences.
Why JSON processing use Jsckson. Since it has been for the Android platform, JsonWriter has better performance?
@chenfei0928 because it uses jackson core streaming api
it would be also nice to test with Jackson-jr (https://github.com/FasterXML/jackson-jr)
I also suggest that it is not slowing down of this library as much as likely speed up of some aspects of Android's SDK. Reflection improvements, as mentioned, would be a huge deal -- Android reflection performance has been really, REALLY bad, and lead to unfortunately high startup times for Jackson (even where Jackson's newer versions try to reduce amount of work done upfront).
AndroidEngTeam replied this about reflection in M and N:
We’ve optimized code paths and code generation related to reflection through M and N. There have been numerous improvements (all of which you can find in AOSP). For example, in N we’ve hand-optimized some of the annotation code.
Very cool. This should help a lot with libraries that rely on reflection. I wonder if there could also be similar improvements to annotation access, which is something that has been slow as well, and possibly due to similar reasons (access to annotation information uses reflection(-like) functionality heavily).
Compile-time annotations don't use any reflection and can't really be optimized. They just end up as code in the app.
@EricKuck I understand, but I was referring to runtime annotations (which LS probably doesn't use, but others like Jackson and GSON do).
I did some tests and found that on recent phones, like the Nexus 6P, LoganSquare doesn't result so fast in comparison with GSON and specially Jackson. Anyone else with this problem, or a device related issue?
Nexus 6P API 23
Samsung S5 API 21