public
anonymous / gist:4333067
Created

metamagic.json vs ujson

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
-[ timing tests ]------------------------------
Array with 256 short ascii strings:
std json: 2.65893 sec, 11282 req/sec
mm c json: 0.89771 sec, 33418 req/sec ( 3.0x )
mm c 1ini: 0.86308 sec, 34759 req/sec ( 3.1x )
mm c dumpb: 0.88435 sec, 33923 req/sec ( 3.0x )
ujson: 2.01593 sec, 14881 req/sec ( 1.3x )
marshal: 1.77637 sec, 16888 req/sec
Array with 2048 3-char ascii strings:
std json: 0.46795 sec, 4273 req/sec
mm c json: 0.12213 sec, 16375 req/sec ( 3.8x )
mm c 1ini: 0.12087 sec, 16546 req/sec ( 3.9x )
mm c dumpb: 0.12081 sec, 16554 req/sec ( 3.9x )
ujson: 0.57373 sec, 3485 req/sec ( 0.8x )
marshal: 0.38574 sec, 5184 req/sec
Array with 256 long ascii strings:
std json: 1.31176 sec, 3811 req/sec
mm c json: 0.42728 sec, 11701 req/sec ( 3.1x )
mm c 1ini: 0.4415 sec, 11325 req/sec ( 3.0x )
mm c dumpb: 0.42976 sec, 11634 req/sec ( 3.1x )
ujson: 0.68999 sec, 7246 req/sec ( 1.9x )
marshal: 0.81957 sec, 6100 req/sec
Array with 256 long utf-8 strings:
std json: 1.5042 sec, 1329 req/sec
mm c json: 1.47078 sec, 1359 req/sec ( 1.0x )
mm c 1ini: 1.47409 sec, 1356 req/sec ( 1.0x )
mm c dumpb: 1.42876 sec, 1399 req/sec ( 1.1x )
ujson: 2.473 sec, 808 req/sec ( 0.6x )
marshal: 1.32233 sec, 1512 req/sec
Medium complex object:
std json: 3.47718 sec, 2875 req/sec
mm c json: 1.37736 sec, 7260 req/sec ( 2.5x )
mm c 1ini: 1.37649 sec, 7264 req/sec ( 2.5x )
mm c dumpb: 1.35585 sec, 7375 req/sec ( 2.6x )
ujson: 1.26684 sec, 7893 req/sec ( 2.7x )
marshal: 1.00874 sec, 9913 req/sec
Array with 256 doubles:
std json: 3.37377 sec, 2964 req/sec
mm c json: 2.20136 sec, 4542 req/sec ( 1.5x )
mm c 1ini: 2.9853 sec, 3349 req/sec ( 1.1x )
mm c dumpb: 2.77406 sec, 3604 req/sec ( 1.2x )
ujson: 0.31939 sec, 31309 req/sec ( 10.6x )
marshal: 0.14199 sec, 70427 req/sec
Array with 256 ints:
std json: 1.1378 sec, 17577 req/sec
mm c json: 0.2816 sec, 71022 req/sec ( 4.0x )
mm c 1ini: 0.25926 sec, 77142 req/sec ( 4.4x )
mm c dumpb: 0.28709 sec, 69664 req/sec ( 4.0x )
ujson: 0.4089 sec, 48911 req/sec ( 2.8x )
marshal: 0.14832 sec, 134843 req/sec
Array with 256 small ints:
std json: 1.2062 sec, 165809 req/sec
mm c json: 0.31506 sec, 634799 req/sec ( 3.8x )
mm c 1ini: 0.10601 sec, 1886614 req/sec ( 11.4x )
mm c dumpb: 0.29149 sec, 686129 req/sec ( 4.1x )
ujson: 0.10513 sec, 1902406 req/sec ( 11.5x )
marshal: 0.09095 sec, 2199010 req/sec
Array with 256 Decimals:
std json: failed to serialize
mm c json: 0.85002 sec, 9411 req/sec ( 0.0x )
mm c 1ini: 0.94584 sec, 8458 req/sec ( 0.0x )
mm c dumpb: 0.85354 sec, 9372 req/sec ( 0.0x )
ujson: crashed with Maximum recursion level reached
marshal: failed to serialize
Array with 256 True values:
std json: 2.31936 sec, 34492 req/sec
mm c json: 0.63926 sec, 125144 req/sec ( 3.6x )
mm c 1ini: 0.40111 sec, 199446 req/sec ( 5.8x )
mm c dumpb: 0.49052 sec, 163092 req/sec ( 4.7x )
ujson: 1.01391 sec, 78902 req/sec ( 2.3x )
marshal: 0.27062 sec, 295617 req/sec
Array with 256 False values:
std json: 1.96338 sec, 40746 req/sec
mm c json: 0.48973 sec, 163355 req/sec ( 4.0x )
mm c 1ini: 0.41958 sec, 190666 req/sec ( 4.7x )
mm c dumpb: 0.4561 sec, 175400 req/sec ( 4.3x )
ujson: 0.96084 sec, 83260 req/sec ( 2.0x )
marshal: 0.24616 sec, 324991 req/sec
Array with 256 dict{string, int} pairs:
std json: 1.70611 sec, 4689 req/sec
mm c json: 0.36205 sec, 22096 req/sec ( 4.7x )
mm c 1ini: 0.35202 sec, 22725 req/sec ( 4.8x )
mm c dumpb: 0.34907 sec, 22918 req/sec ( 4.9x )
ujson: 0.59559 sec, 13432 req/sec ( 2.9x )
marshal: 0.52467 sec, 15247 req/sec
Array with 256 dict-based{string, int} pairs:
std json: 3.98171 sec, 2009 req/sec
mm c json: 3.62291 sec, 2208 req/sec ( 1.1x )
mm c 1ini: 3.58263 sec, 2232 req/sec ( 1.1x )
mm c dumpb: 3.76489 sec, 2124 req/sec ( 1.1x )
ujson: 0.58567 sec, 13659 req/sec ( 6.8x )
marshal: failed to serialize
Array with 256 orderedDict{string, int} pairs:
std json: 2.20037 sec, 454 req/sec
mm c json: 0.68094 sec, 1468 req/sec ( 3.2x )
mm c 1ini: 0.68384 sec, 1462 req/sec ( 3.2x )
mm c dumpb: 0.65653 sec, 1523 req/sec ( 3.4x )
ujson: 0.22893 sec, 4368 req/sec ( 9.6x )
marshal: failed to serialize
Dict with 256 arrays with 256 dict{string, int} pairs:
std json: 3.58892 sec, 13 req/sec
mm c json: 0.67028 sec, 74 req/sec ( 5.4x )
mm c 1ini: 0.73365 sec, 68 req/sec ( 4.9x )
mm c dumpb: 0.66326 sec, 75 req/sec ( 5.4x )
ujson: 1.20702 sec, 41 req/sec ( 3.0x )
marshal: 1.01116 sec, 49 req/sec

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.