when converting a POJO into a JSONObject we are experiencing performance degradations due to the annotation search in superclasses of the POJO.
The method getAnnotationDepth in JSONObject should not search methods in superclasses if the superclass is java.lang.Object. At the moment the search is stopped only if the superclass is null, i.e. the Object-class is searched also. This leads to recurring NoSuchMethodExceptions, which are catched but unnecessary.
A short performance test for a big HashMap (only POJOs) being converted to a JSONObject showed 900ms duration with the actual code. When avoiding the search in java.lang.Object the conversion of the same map takes only less than 70ms on the same system/environment.
Hi,
when converting a POJO into a JSONObject we are experiencing performance degradations due to the annotation search in superclasses of the POJO.
The method getAnnotationDepth in JSONObject should not search methods in superclasses if the superclass is java.lang.Object. At the moment the search is stopped only if the superclass is null, i.e. the Object-class is searched also. This leads to recurring NoSuchMethodExceptions, which are catched but unnecessary.
A short performance test for a big HashMap (only POJOs) being converted to a JSONObject showed 900ms duration with the actual code. When avoiding the search in java.lang.Object the conversion of the same map takes only less than 70ms on the same system/environment.