...
The cited article also shows benchmarks from 2017 in which Jackson parser was out performing GSON in the large file category. We can surmise that there is a constant battle between these objectMappers and Jackson may begin out performing GSON again in the future. For example this article from 2019 with new benchmarks states that the difference between the different mappers is negligible, with Jackson mapper having a slight lead with larger files.
Resolution
It would make the most sense to use GSON as much as possible as it is the faster than Jackson. However the practicality of Jacksons parsing cannot be overlooked. Therefore it would make sense to use the Jackson parser in this scenario. We also don't want to have or create a Jackson mapper and GSON mapper object in the same file however as the memory cost is quite high.
...
Test Results
Parser | Operation | Execution time in microseconds | Issues | ||
---|---|---|---|---|---|
40 characters | 100 characters | 1000 characters | |||
Jackson | Read | 7 | 11 | 50 | |
GSON | Read | <1 | <1 | 8 | GSON parses all numerical values to Doubles and as such it unable to dynamically allocate the object type that it is parsing |
Jackson | Write | <1 | <1 | 5 | |
GSON | Write | <1 | 1 | 15 |
Parser | Pros | Cons |
---|---|---|
Jackson | Consistent conversion of numerics | Slower Read |
GSON | Faster Reads | Converts numerics to Doubles |
Consensus
Current Team Consensus is to use the Jackson Parser mainly due to the benefit of being able to parse numerical objects to the correct type and because the magnitude difference between the two parsers is in microseconds.
View file | ||||
---|---|---|---|---|
|
CPS-NCMP
- CpsDataPersistenceServiceImpl.java is using two mapper objects, GSON and Jackson, should be just Jackson
- NetworkCmProxyInventoryController.java is using the Jackson mapper where the GSON could be used instead
- NetworkCmProxyDataServiceImpl.java is using the Jackson mapper where the GSON could be used instead
Temporal
...
Independent Testing Output
...