Created
June 21, 2011 04:47
-
-
Save devongovett/1037265 to your computer and use it in GitHub Desktop.
jsondb + msgpack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [], | |
obj = {'abcdef' : 1, 'qqq' : 13, '19' : [1, 2, 3, 4]}; | |
for(var i = 0; i < 5000; i++) | |
arr.push(obj); | |
// jsondb(arr) looks something like this: | |
// ["abcdef", "qqq", "19", [1, 13, [1, 2, 3, 4]], [1, 13, [1, 2, 3, 4]]...] | |
> JSON.stringify(arr).length //original | |
> 185001 | |
> JSON.stringify(jsondb(arr)).length //jsondb | |
> 85030 // 54% size decrease | |
> MsgPack.pack(arr).length // just msgpack | |
> 110003 // 40% size decrease | |
> MsgPack.pack(jsondb(arr)).length // msgpack + jsondb | |
> 40024 // 78% size decrease |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment