...
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
View file | ||||
---|---|---|---|---|
|
TEST 1
Row Length: 20
Amount of Rows: 2
Total Characters:40
Sample 1 of 1000 for context:
{
"shtejaotq":743274541,
"kgemtnjax":835572493
}Parsing Jackson
Jackson Total Execution Time for 1000 Samples: 7488 milliseconds
Average Execution Time per Sample: 7.488 microseconds
Parsing GSON
GSON Total Execution Time for 1000 Samples: 509 milliseconds
Average Execution Time per Sample: 0.509 microseconds
COMPARISON
JACKSON GSON
{"yawjfhvyp":372757483 {"yawjfhvyp":3.72757483E8
"ylldgoxat":969019115} "ylldgoxat":9.69019115E8}TEST 2
Row Length: 20
Amount of Rows: 5
Total Characters:100
Sample 1 of 1000 for context:
{
"ghnnxacwg":627166312,
"weexbqxxz":187860979,
"vnazlwjxw":888464657,
"lefllbkav":680153916,
"qwwmuullq":956680572
}Parsing Jackson
Jackson Total Execution Time for 1000 Samples: 10520 milliseconds
Average Execution Time per Sample: 10.52 microseconds
Parsing GSON
GSON Total Execution Time for 1000 Samples: 850 milliseconds
Average Execution Time per Sample: 0.85 microseconds
COMPARISON
JACKSON GSON
{"lyfxouunw":236275535 {"lyfxouunw":2.36275535E8
"okhwigzvc":585267299 "okhwigzvc":5.85267299E8
"nahwamzec":104464991 "nahwamzec":1.04464991E8
"ijmlmqira":780085959 "ijmlmqira":7.80085959E8
"othqkndmv":960833419} "othqkndmv":9.60833419E8}TEST 3
Row Length: 20
Amount of Rows: 50
Total Characters:1000
Sample 1 of 1000 for context:
{
"wptqxblfb":553507548,
"nbaxtredu":324083139,
"vqijoaziu":144390721,
"nrwxqbgas":306788077,
"ogbdryyoj":104971927,
"gkfbdrkbk":537378619,
"lshdskcve":236309228,
"wtbpnxjew":554359094,
"uhmaenhuy":322770800,
"ysiwzhxiu":989652357,
"qpvpcbrvd":158784720,
"qzljjisii":855712766,
"ifcyebeni":770824879,
"mwjwjmwer":626375442,
"etbqaeboc":294862340,
"wwddrycum":747061501,
"ugahmwclb":382668205,
"hwgxefgfq":423926323,
"qrpzsnpxq":332204537,
"diltsosly":127063694,
"ojsnimjad":759601613,
"yvfldgicy":756794624,
"zpqlhzosx":861493871,
"opyuujuct":836421890,
"oezsrutkj":800198261,
"yohdudboz":145523060,
"wvzxkcrhm":690445487,
"nuykqqjaf":646580393,
"fmyuzacqr":321286835,
"cqvwhippk":361635443,
"ntkyveeyv":444123298,
"vkzeyelky":640545391,
"cqxvhhpzl":745212950,
"iywlqqrpl":466710234,
"owxlxezzx":325644550,
"cxtuhlccj":538982643,
"qriscgyzx":528896083,
"atgeacdce":134644427,
"ieiiysmej":992409710,
"rlfgmhqvw":975947788,
"nlywhmjfu":670148981,
"yhjndhnzn":889909995,
"scfkrsbxz":198224877,
"tuyfyfxmv":383221605,
"gnhazathn":405891282,
"hyhucemxu":324333145,
"wkicvnnhr":785344246,
"kkodozrmr":241548242,
"hjprcgaul":229512854,
"tpmydsvvj":725765670
}Parsing Jackson
Jackson Total Execution Time for 1000 Samples: 52106 milliseconds
Average Execution Time per Sample: 52.106 microseconds
Parsing GSON
GSON Total Execution Time for 1000 Samples: 8499 milliseconds
Average Execution Time per Sample: 8.499 microseconds
COMPARISON
JACKSON GSON
{"kvpbkfjhc":909199666 {"kvpbkfjhc":9.09199666E8
"zfhxzemfw":636239367 "zfhxzemfw":6.36239367E8
"ljxducldl":489368253 "ljxducldl":4.89368253E8
"zpdpwotfl":591944248 "zpdpwotfl":5.91944248E8
"wjiooqzia":482992080 "wjiooqzia":4.8299208E8
"iochjfkus":332831284 "iochjfkus":3.32831284E8
"uxnfdjojz":938890734 "uxnfdjojz":9.38890734E8
"xbltjaqew":299425690 "xbltjaqew":2.9942569E8
"hkjdmxxmb":962254859 "hkjdmxxmb":9.62254859E8
"fjmcgobhn":547992639 "fjmcgobhn":5.47992639E8
"orwzpzzmu":820807822 "orwzpzzmu":8.20807822E8
"rfdbekjcx":275097929 "rfdbekjcx":2.75097929E8
"uxxozjoih":338627736 "uxxozjoih":3.38627736E8
"cjlkfjjcq":448937027 "cjlkfjjcq":4.48937027E8
"uqnnirliu":276864552 "uqnnirliu":2.76864552E8
"lxceqgufg":689678773 "lxceqgufg":6.89678773E8
"adjltrxoz":822406043 "adjltrxoz":8.22406043E8
"rnwctlvde":489461099 "rnwctlvde":4.89461099E8
"ajyeaqtpm":736075494 "ajyeaqtpm":7.36075494E8
"enrwfbntn":315084877 "enrwfbntn":3.15084877E8
"nvwhgxcxw":823902435 "nvwhgxcxw":8.23902435E8
"ejjxpccwz":908806150 "ejjxpccwz":9.0880615E8
"veazdvefx":718686888 "veazdvefx":7.18686888E8
"eleirpwya":811890070 "eleirpwya":8.1189007E8
"pgexoohtk":447322823 "pgexoohtk":4.47322823E8
"mxhfkpqen":871899106 "mxhfkpqen":8.71899106E8
"iifipqvuw":139827220 "iifipqvuw":1.3982722E8
"fvnltlqqz":651683652 "fvnltlqqz":6.51683652E8
"wtizegpgx":912094992 "wtizegpgx":9.12094992E8
"xtunumvys":521832782 "xtunumvys":5.21832782E8
"qofahiuca":177980881 "qofahiuca":1.77980881E8
"ddwgkqroa":563486320 "ddwgkqroa":5.6348632E8
"khgummffv":566546040 "khgummffv":5.6654604E8
"embvwgzxc":622414218 "embvwgzxc":6.22414218E8
"twjmhskgi":464054761 "twjmhskgi":4.64054761E8
"zntblffps":297389465 "zntblffps":2.97389465E8
"csdabfnfd":830710612 "csdabfnfd":8.30710612E8
"miofuwofz":386871027 "miofuwofz":3.86871027E8
"zgkzlkncq":675690367 "zgkzlkncq":6.75690367E8
"ghysxtjcm":499019987 "ghysxtjcm":4.99019987E8
"yixisblvx":287911842 "yixisblvx":2.87911842E8
"cvzmszwrj":880215017 "cvzmszwrj":8.80215017E8
"ghxqtrkaj":569935571 "ghxqtrkaj":5.69935571E8
"xnqnpdlzv":654646769 "xnqnpdlzv":6.54646769E8
"mujytcjkn":695265416 "mujytcjkn":6.95265416E8
"queybotdd":507165384 "queybotdd":5.07165384E8
"ikboejdrj":492564702 "ikboejdrj":4.92564702E8
"mlcicbvki":909981316 "mlcicbvki":9.09981316E8
"kakwtlukw":839042731 "kakwtlukw":8.39042731E8
"dacnlsxxc":636897263} "dacnlsxxc":6.36897263E8}