Open paneq opened 6 years ago
Test cases:
Perhaps we can re-use https://github.com/stereobooster/ruby-json-benchmark/blob/master/README.md
user system total real
Psych: nil serialization 2.448878 0.263548 2.712426 ( 2.732682)
JSON: nil serialization 0.179555 0.029331 0.208886 ( 0.210359)
MessagePack: nil serialization 0.204782 0.040006 0.244788 ( 0.248339)
ProtobufNestedStruct: nil serialization 0.125626 0.002576 0.128202 ( 0.129706)
user system total real
Psych: nil deserialization 1.957411 0.290001 2.247412 ( 2.287906)
JSON: nil deserialization 0.266715 0.123197 0.389912 ( 0.396844)
MessagePack: nil deserialization 0.512591 0.044051 0.556642 ( 0.560779)
ProtobufNestedStruct: nil deserialization 0.100339 0.002755 0.103094 ( 0.105264)
user system total real
Psych: small int serialization 2.524634 0.255613 2.780247 ( 2.809513)
JSON: small int serialization 0.181438 0.033612 0.215050 ( 0.216941)
MessagePack: small int serialization 0.144282 0.034793 0.179075 ( 0.180689)
ProtobufNestedStruct: small int serialization 0.129854 0.002372 0.132226 ( 0.133430)
user system total real
Psych: small int deserialization 2.647879 0.275455 2.923334 ( 2.961280)
JSON: small int deserialization 0.296658 0.130535 0.427193 ( 0.430252)
MessagePack: small int deserialization 0.294159 0.048178 0.342337 ( 0.344707)
ProtobufNestedStruct: small int deserialization 0.113609 0.004729 0.118338 ( 0.119060)
user system total real
Psych: short string serialization 2.883552 0.233303 3.116855 ( 3.138843)
JSON: short string serialization 0.228395 0.048165 0.276560 ( 0.279271)
MessagePack: short string serialization 0.132262 0.013748 0.146010 ( 0.147000)
ProtobufNestedStruct: short string serialization 0.145112 0.003997 0.149109 ( 0.150029)
user system total real
Psych: short string deserialization 2.162649 0.277087 2.439736 ( 2.456237)
JSON: short string deserialization 0.263117 0.105357 0.368474 ( 0.371328)
MessagePack: short string deserialization 0.256440 0.047900 0.304340 ( 0.307077)
ProtobufNestedStruct: short string deserialization 0.118391 0.002307 0.120698 ( 0.121401)
user system total real
Psych: float serialization 2.456506 0.233799 2.690305 ( 2.709710)
JSON: float serialization 0.236081 0.049566 0.285647 ( 0.287740)
MessagePack: float serialization 0.131733 0.014682 0.146415 ( 0.148496)
ProtobufNestedStruct: float serialization 0.132446 0.002135 0.134581 ( 0.135740)
user system total real
Psych: float deserialization 2.553555 0.264045 2.817600 ( 2.836723)
JSON: float deserialization 0.298166 0.131059 0.429225 ( 0.432665)
MessagePack: float deserialization 0.233618 0.041547 0.275165 ( 0.277959)
ProtobufNestedStruct: float deserialization 0.115382 0.003188 0.118570 ( 0.120147)
user system total real
Psych: date serialization 2.417456 0.244787 2.662243 ( 2.682152)
JSON: date serialization 0.316322 0.057219 0.373541 ( 0.376442)
ProtobufNestedStruct: date serialization 0.351827 0.007029 0.358856 ( 0.361160)
user system total real
Psych: date deserialization 4.370959 0.332985 4.703944 ( 4.734959)
JSON: date deserialization 0.235263 0.058724 0.293987 ( 0.296013)
ProtobufNestedStruct: date deserialization 0.274693 0.006822 0.281515 ( 0.283365)
user system total real
Psych: time serialization 2.893955 0.283968 3.177923 ( 3.215062)
JSON: time serialization 0.411201 0.058775 0.469976 ( 0.472833)
ProtobufNestedStruct: time serialization 0.312994 0.003987 0.316981 ( 0.319477)
user system total real
Psych: time deserialization 3.472854 0.309833 3.782687 ( 3.805695)
JSON: time deserialization 0.236045 0.056203 0.292248 ( 0.294068)
ProtobufNestedStruct: time deserialization 0.370508 0.009611 0.380119 ( 0.383413)
user system total real
Psych: array of nil serialization 2.549165 0.028303 2.577468 ( 2.637720)
JSON: array of nil serialization 0.012144 0.002531 0.014675 ( 0.014761)
MessagePack: array of nil serialization 0.004584 0.000191 0.004775 ( 0.004814)
ProtobufNestedStruct: array of nil serialization 1.472616 0.028790 1.501406 ( 1.511178)
user system total real
Psych: array of nil deserialization 2.174557 0.097911 2.272468 ( 2.286466)
JSON: array of nil deserialization 0.014900 0.002841 0.017741 ( 0.017765)
MessagePack: array of nil deserialization 0.015079 0.002421 0.017500 ( 0.017648)
ProtobufNestedStruct: array of nil deserialization 1.065305 0.034338 1.099643 ( 1.105660)
user system total real
Psych: array of small int serialization 2.366143 0.024407 2.390550 ( 2.403611)
JSON: array of small int serialization 0.021394 0.003267 0.024661 ( 0.024843)
MessagePack: array of small int serialization 0.007690 0.001479 0.009169 ( 0.009341)
ProtobufNestedStruct: array of small int serialization 1.361054 0.026191 1.387245 ( 1.394848)
user system total real
Psych: array of small int deserialization 7.575425 0.053578 7.629003 ( 7.689960)
JSON: array of small int deserialization 0.052694 0.004179 0.056873 ( 0.057450)
MessagePack: array of small int deserialization 0.015999 0.002446 0.018445 ( 0.018489)
ProtobufNestedStruct: array of small int deserialization 1.110337 0.036713 1.147050 ( 1.152820)
user system total real
Psych: array of short string serialization 4.001517 0.036278 4.037795 ( 4.069937)
JSON: array of short string serialization 0.214699 0.019807 0.234506 ( 0.236201)
MessagePack: array of short string serialization 0.019158 0.005245 0.024403 ( 0.025149)
ProtobufNestedStruct: array of short string serialization 1.740274 0.048211 1.788485 ( 1.799906)
user system total real
Psych: array of short string deserialization 2.862263 0.024969 2.887232 ( 2.913564)
JSON: array of short string deserialization 0.241175 0.009751 0.250926 ( 0.252583)
MessagePack: array of short string deserialization 0.050712 0.002574 0.053286 ( 0.053535)
ProtobufNestedStruct: array of short string deserialization 1.532416 0.017621 1.550037 ( 1.559317)
user system total real
Psych: array of float serialization 2.826964 0.022774 2.849738 ( 2.866004)
JSON: array of float serialization 0.404895 0.011882 0.416777 ( 0.430425)
MessagePack: array of float serialization 0.012496 0.003130 0.015626 ( 0.015966)
ProtobufNestedStruct: array of float serialization 1.495490 0.026786 1.522276 ( 1.545614)
user system total real
Psych: array of float deserialization 7.099668 0.049336 7.149004 ( 7.197595)
JSON: array of float deserialization 0.051954 0.004996 0.056950 ( 0.057542)
MessagePack: array of float deserialization 0.018327 0.002172 0.020499 ( 0.020572)
ProtobufNestedStruct: array of float deserialization 1.111791 0.029595 1.141386 ( 1.147453)
user system total real
Psych: array of date serialization 2.709264 0.027364 2.736628 ( 2.750388)
JSON: array of date serialization 0.849214 0.015168 0.864382 ( 0.867695)
ProtobufNestedStruct: array of date serialization 3.911556 0.076081 3.987637 ( 4.008709)
user system total real
Psych: array of date deserialization 22.448564 0.087520 22.536084 ( 22.640424)
JSON: array of date deserialization 0.235909 0.005035 0.240944 ( 0.242994)
ProtobufNestedStruct: array of date deserialization 3.687881 0.188448 3.876329 ( 3.897792)
user system total real
Psych: array of time serialization 1.758743 0.022235 1.780978 ( 1.790837)
JSON: array of time serialization 1.799289 0.027752 1.827041 ( 1.837535)
ProtobufNestedStruct: array of time serialization 3.037221 0.059115 3.096336 ( 3.114654)
user system total real
Psych: array of time deserialization 1.793526 0.025112 1.818638 ( 1.893499)
JSON: array of time deserialization 0.281552 0.008107 0.289659 ( 0.292544)
ProtobufNestedStruct: array of time deserialization 3.623468 0.040401 3.663869 ( 3.686241)
user system total real
Psych: hash, values of nil serialization 11.196366 0.104378 11.300744 ( 11.439688)
JSON: hash, values of nil serialization 0.457176 0.025994 0.483170 ( 0.485533)
MessagePack: hash, values of nil serialization 0.028632 0.003498 0.032130 ( 0.032295)
ProtobufNestedStruct: hash, values of nil serialization 11.919115 0.093949 12.013064 ( 12.102155)
user system total real
Psych: hash, values of nil deserialization 9.756293 0.278428 10.034721 ( 10.308782)
JSON: hash, values of nil deserialization 0.497938 0.018454 0.516392 ( 0.521030)
MessagePack: hash, values of nil deserialization 0.143622 0.006812 0.150434 ( 0.151659)
ProtobufNestedStruct: hash, values of nil deserialization 9.946449 0.049560 9.996009 ( 10.091151)
user system total real
Psych: hash, values of small int serialization 11.271574 0.107301 11.378875 ( 11.475696)
JSON: hash, values of small int serialization 0.482933 0.020550 0.503483 ( 0.505140)
MessagePack: hash, values of small int serialization 0.054446 0.005055 0.059501 ( 0.059882)
ProtobufNestedStruct: hash, values of small int serialization 12.288508 0.123746 12.412254 ( 12.592326)
user system total real
Psych: hash, values of small int deserialization 17.237087 0.232490 17.469577 ( 18.111267)
JSON: hash, values of small int deserialization 0.583564 0.018533 0.602097 ( 0.608558)
MessagePack: hash, values of small int deserialization 0.200332 0.007721 0.208053 ( 0.215973)
ProtobufNestedStruct: hash, values of small int deserialization 10.652195 0.080474 10.732669 ( 10.876229)
user system total real
Psych: hash, values of short string serialization 12.522711 0.087183 12.609894 ( 12.689811)
JSON: hash, values of short string serialization 0.722348 0.039089 0.761437 ( 0.764064)
MessagePack: hash, values of short string serialization 0.094208 0.013617 0.107825 ( 0.108056)
ProtobufNestedStruct: hash, values of short string serialization 12.198991 0.083270 12.282261 ( 12.343487)
user system total real
Psych: hash, values of short string deserialization 10.298667 0.076939 10.375606 ( 10.462351)
JSON: hash, values of short string deserialization 0.717977 0.015194 0.733171 ( 0.735399)
MessagePack: hash, values of short string deserialization 0.181455 0.006540 0.187995 ( 0.188909)
ProtobufNestedStruct: hash, values of short string deserialization 10.471573 0.068465 10.540038 ( 10.850286)
user system total real
Psych: hash, values of float serialization 12.265394 0.116292 12.381686 ( 12.547771)
JSON: hash, values of float serialization 0.786902 0.019149 0.806051 ( 0.809252)
MessagePack: hash, values of float serialization 0.058761 0.007813 0.066574 ( 0.066711)
ProtobufNestedStruct: hash, values of float serialization 11.942884 0.126018 12.068902 ( 12.164074)
user system total real
Psych: hash, values of float deserialization 16.613721 0.218206 16.831927 ( 17.192540)
JSON: hash, values of float deserialization 0.554655 0.016233 0.570888 ( 0.574270)
MessagePack: hash, values of float deserialization 0.179655 0.005737 0.185392 ( 0.187433)
ProtobufNestedStruct: hash, values of float deserialization 9.913870 0.052028 9.965898 ( 10.007526)
user system total real
Psych: hash, values of date serialization 11.505373 0.078636 11.584009 ( 11.629563)
JSON: hash, values of date serialization 1.295426 0.028877 1.324303 ( 1.327856)
ProtobufNestedStruct: hash, values of date serialization 15.204038 0.114020 15.318058 ( 15.465274)
user system total real
Psych: hash, values of date deserialization 32.567930 0.501846 33.069776 ( 33.366530)
JSON: hash, values of date deserialization 0.729516 0.013730 0.743246 ( 0.750756)
ProtobufNestedStruct: hash, values of date deserialization 13.369470 0.143000 13.512470 ( 13.968726)
user system total real
Psych: hash, values of time serialization 11.276223 0.093612 11.369835 ( 11.507610)
JSON: hash, values of time serialization 2.421728 0.042963 2.464691 ( 2.480735)
ProtobufNestedStruct: hash, values of time serialization 15.123799 0.169388 15.293187 ( 15.588447)
user system total real
Psych: hash, values of time deserialization 9.389752 0.067603 9.457355 ( 9.510375)
JSON: hash, values of time deserialization 0.740572 0.012775 0.753347 ( 0.768536)
ProtobufNestedStruct: hash, values of time deserialization 13.263563 0.072684 13.336247 ( 13.418087)
Compare with YAML/JSON/Messagepack