Skip to content

Latest commit

 

History

History
460 lines (365 loc) · 97.6 KB

PERFORMANCE.md

File metadata and controls

460 lines (365 loc) · 97.6 KB

⚡ Performance Test Results

Test time and Versions

  1. Test time : Sun Dec 22 11:01:20 2024 UTC

  2. PocketMine-MP : 5.23.2+dev (#1481977)

  3. nbt-serializer : 2.0.0 (#e516596)

Types of Data Compared

  1. serialize-time

    • The time taken to serialize data into the respective format.
    • Measured in nanoseconds (ns) to evaluate processing speed.
  2. deserialize-time

    • The time taken to deserialize data back into its original form.
    • Also measured in nanoseconds (ns), assessing the performance of data restoration.
  3. serialized-size

    • The size of the serialized data in bytes.
    • Used to analyze data efficiency and storage requirements.
  4. escaped-size

    • The size of the serialize data encoded into a storable string format using json_encode().
    • For testing compatibility in environments where binary data cannot be used directly (JSON or URL, etc...).

Result tables

BYTE 0 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1298ns %2B1093%25 2181ns %2B286%25 4bytes %2B200%25 26bytes %2B650%25
PMMP(BASE64) 1361ns %2B1146%25 2079ns %2B272%25 8bytes %2B400%25 10bytes %2B250%25
PMMP(BINHEX) 1350ns %2B1136%25 2181ns %2B286%25 8bytes %2B400%25 10bytes %2B250%25
SNBT 119ns %2B100%25 762ns %2B100%25 2bytes %2B100%25 4bytes %2B100%25
0b

BYTE 8 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1371ns %2B1043%25 2050ns %2B225%25 4bytes %2B133%25 21bytes %2B420%25
PMMP(BASE64) 1358ns %2B1032%25 2078ns %2B228%25 8bytes %2B266%25 10bytes %2B200%25
PMMP(BINHEX) 1360ns %2B1034%25 2063ns %2B226%25 8bytes %2B266%25 10bytes %2B200%25
SNBT 131ns %2B100%25 909ns %2B100%25 3bytes %2B100%25 5bytes %2B100%25
64b

SHORT 0 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1369ns %2B1133%25 2241ns %2B288%25 5bytes %2B250%25 32bytes %2B800%25
PMMP(BASE64) 1447ns %2B1198%25 2348ns %2B302%25 8bytes %2B400%25 10bytes %2B250%25
PMMP(BINHEX) 1443ns %2B1195%25 2305ns %2B297%25 8bytes %2B400%25 10bytes %2B250%25
SNBT 121ns %2B100%25 775ns %2B100%25 2bytes %2B100%25 4bytes %2B100%25
0s

SHORT 8 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1370ns %2B1000%25 2237ns %2B171%25 5bytes %2B100%25 27bytes %2B337%25
PMMP(BASE64) 1525ns %2B1113%25 3121ns %2B238%25 8bytes %2B160%25 10bytes %2B125%25
PMMP(BINHEX) 1452ns %2B1060%25 2336ns %2B178%25 8bytes %2B160%25 10bytes %2B125%25
SNBT 137ns %2B100%25 1306ns %2B100%25 6bytes %2B120%25 8bytes %2B100%25
16384s

INT 0 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1397ns %2B1297%25 2311ns %2B355%25 7bytes %2B700%25 44bytes %2B1466%25
PMMP(BASE64) 2678ns %2B2487%25 3252ns %2B500%25 12bytes %2B1200%25 14bytes %2B466%25
PMMP(BINHEX) 1466ns %2B1362%25 2417ns %2B371%25 12bytes %2B1200%25 14bytes %2B466%25
SNBT 108ns %2B100%25 650ns %2B100%25 1bytes %2B100%25 3bytes %2B100%25
0

INT 32 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1402ns %2B1095%25 2317ns %2B128%25 7bytes %2B100%25 39bytes %2B325%25
PMMP(BASE64) 1599ns %2B1249%25 2921ns %2B162%25 12bytes %2B171%25 14bytes %2B116%25
PMMP(BINHEX) 1470ns %2B1148%25 2607ns %2B144%25 12bytes %2B171%25 14bytes %2B116%25
SNBT 128ns %2B100%25 1801ns %2B100%25 10bytes %2B142%25 12bytes %2B100%25
1073741824

LONG 0 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1404ns %2B1166%25 2228ns %2B284%25 11bytes %2B550%25 68bytes %2B1700%25
PMMP(BASE64) 1482ns %2B1230%25 2309ns %2B294%25 16bytes %2B800%25 18bytes %2B450%25
PMMP(BINHEX) 1520ns %2B1262%25 3576ns %2B456%25 16bytes %2B800%25 18bytes %2B450%25
SNBT 120ns %2B100%25 783ns %2B100%25 2bytes %2B100%25 4bytes %2B100%25
0l

LONG 64 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1407ns %2B923%25 2215ns %2B100%25 11bytes %2B100%25 63bytes %2B350%25
PMMP(BASE64) 1471ns %2B965%25 2310ns %2B104%25 16bytes %2B145%25 18bytes %2B100%25
PMMP(BINHEX) 2166ns %2B1421%25 4176ns %2B188%25 16bytes %2B145%25 18bytes %2B100%25
SNBT 152ns %2B100%25 3548ns %2B160%25 20bytes %2B181%25 22bytes %2B122%25
4611686018427387904l

FLOAT 0 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1461ns %2B871%25 2230ns %2B288%25 7bytes %2B350%25 44bytes %2B1100%25
PMMP(BASE64) 1464ns %2B873%25 2279ns %2B294%25 12bytes %2B600%25 14bytes %2B350%25
PMMP(BINHEX) 1856ns %2B1107%25 3440ns %2B445%25 12bytes %2B600%25 14bytes %2B350%25
SNBT 168ns %2B100%25 773ns %2B100%25 2bytes %2B100%25 4bytes %2B100%25
0f

FLOAT 16 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1396ns %2B434%25 2213ns %2B100%25 7bytes %2B100%25 29bytes %2B207%25
PMMP(BASE64) 1464ns %2B455%25 2287ns %2B103%25 12bytes %2B171%25 14bytes %2B100%25
PMMP(BINHEX) 1897ns %2B590%25 3027ns %2B136%25 12bytes %2B171%25 14bytes %2B100%25
SNBT 321ns %2B100%25 2630ns %2B118%25 16bytes %2B228%25 18bytes %2B128%25
1234567890.1235f

DOUBLE 0 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1419ns %2B852%25 2218ns %2B286%25 11bytes %2B550%25 68bytes %2B1700%25
PMMP(BASE64) 1482ns %2B890%25 2291ns %2B296%25 16bytes %2B800%25 18bytes %2B450%25
PMMP(BINHEX) 2275ns %2B1366%25 3333ns %2B430%25 16bytes %2B800%25 18bytes %2B450%25
SNBT 167ns %2B100%25 774ns %2B100%25 2bytes %2B100%25 4bytes %2B100%25
0d

DOUBLE 16 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1406ns %2B435%25 2219ns %2B100%25 11bytes %2B100%25 28bytes %2B155%25
PMMP(BASE64) 1484ns %2B459%25 2296ns %2B103%25 16bytes %2B145%25 18bytes %2B100%25
PMMP(BINHEX) 1848ns %2B572%25 2364ns %2B106%25 16bytes %2B145%25 18bytes %2B100%25
SNBT 323ns %2B100%25 2631ns %2B118%25 16bytes %2B145%25 18bytes %2B100%25
1234567890.1235d

STRING EMPTY serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1522ns %2B988%25 2204ns %2B326%25 5bytes %2B250%25 28bytes %2B466%25
PMMP(BASE64) 1584ns %2B1028%25 2786ns %2B413%25 8bytes %2B400%25 10bytes %2B166%25
PMMP(BINHEX) 2476ns %2B1608%25 2829ns %2B419%25 8bytes %2B400%25 10bytes %2B166%25
SNBT 154ns %2B100%25 674ns %2B100%25 2bytes %2B100%25 6bytes %2B100%25
""

STRING 1024 serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1562ns %2B139%25 2418ns %2B112%25 1029bytes %2B100%25 1052bytes %2B102%25
PMMP(BASE64) 1776ns %2B159%25 2747ns %2B127%25 1372bytes %2B133%25 1374bytes %2B133%25
PMMP(BINHEX) 2337ns %2B209%25 4115ns %2B191%25 1372bytes %2B133%25 1374bytes %2B133%25
SNBT 1117ns %2B100%25 2151ns %2B100%25 1026bytes %2B100%25 1030bytes %2B100%25
"----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"

STRING ESCAPED serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1526ns %2B772%25 2365ns %2B283%25 15bytes %2B100%25 72bytes %2B327%25
PMMP(BASE64) 1603ns %2B811%25 2489ns %2B298%25 20bytes %2B133%25 22bytes %2B100%25
PMMP(BINHEX) 1601ns %2B810%25 3724ns %2B446%25 20bytes %2B133%25 22bytes %2B100%25
SNBT 197ns %2B100%25 834ns %2B100%25 50bytes %2B333%25 64bytes %2B290%25
"\r\n\t\u0001\u0002\u0003\u0004\u0005\u0006\u0007"

BYTE_ARRAY EMPTY serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 2759ns %2B2322%25 2702ns %2B432%25 7bytes %2B175%25 44bytes %2B733%25
PMMP(BASE64) 1536ns %2B1292%25 2430ns %2B388%25 12bytes %2B300%25 14bytes %2B233%25
PMMP(BINHEX) 1654ns %2B1392%25 3104ns %2B496%25 12bytes %2B300%25 14bytes %2B233%25
SNBT 119ns %2B100%25 625ns %2B100%25 4bytes %2B100%25 6bytes %2B100%25
[B;]

BYTE_ARRAY 128_ITEM serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1907ns %2B116%25 2735ns %2B103%25 135bytes %2B100%25 167bytes %2B100%25
PMMP(BASE64) 1632ns %2B100%25 2653ns %2B100%25 180bytes %2B133%25 182bytes %2B108%25
PMMP(BINHEX) 2326ns %2B142%25 2641ns %2B100%25 180bytes %2B133%25 182bytes %2B108%25
SNBT 6950ns %2B425%25 16302ns %2B617%25 515bytes %2B381%25 517bytes %2B309%25
[B;45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b,45b]

INT_ARRAY EMPTY serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1749ns %2B1486%25 2599ns %2B408%25 7bytes %2B175%25 44bytes %2B733%25
PMMP(BASE64) 1608ns %2B1367%25 2524ns %2B397%25 12bytes %2B300%25 14bytes %2B233%25
PMMP(BINHEX) 1606ns %2B1364%25 2523ns %2B396%25 12bytes %2B300%25 14bytes %2B233%25
SNBT 118ns %2B100%25 636ns %2B100%25 4bytes %2B100%25 6bytes %2B100%25
[I;]

INT_ARRAY 128_ITEM serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 3006ns %2B352%25 4745ns %2B100%25 519bytes %2B200%25 3111bytes %2B1191%25
PMMP(BASE64) 2907ns %2B340%25 6529ns %2B137%25 692bytes %2B267%25 694bytes %2B265%25
PMMP(BINHEX) 2958ns %2B346%25 6421ns %2B135%25 692bytes %2B267%25 694bytes %2B265%25
SNBT 854ns %2B100%25 10081ns %2B212%25 259bytes %2B100%25 261bytes %2B100%25
[I;0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

LIST EMPTY serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1592ns %2B986%25 2642ns %2B416%25 8bytes %2B400%25 46bytes %2B1150%25
PMMP(BASE64) 1666ns %2B1032%25 2732ns %2B430%25 12bytes %2B600%25 14bytes %2B350%25
PMMP(BINHEX) 1690ns %2B1047%25 2750ns %2B433%25 12bytes %2B600%25 14bytes %2B350%25
SNBT 161ns %2B100%25 634ns %2B100%25 2bytes %2B100%25 4bytes %2B100%25
[]

LIST 128_ITEM serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 60948ns %2B226%25 90126ns %2B100%25 648bytes %2B168%25 3877bytes %2B1001%25
PMMP(BASE64) 65096ns %2B241%25 166334ns %2B184%25 864bytes %2B224%25 866bytes %2B223%25
PMMP(BINHEX) 61784ns %2B229%25 170760ns %2B189%25 864bytes %2B224%25 866bytes %2B223%25
SNBT 26929ns %2B100%25 118824ns %2B131%25 385bytes %2B100%25 387bytes %2B100%25
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]

LIST 64_DEPTH serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 31950ns %2B101%25 111974ns %2B195%25 323bytes %2B252%25 1684bytes %2B1295%25
PMMP(BASE64) 32083ns %2B102%25 108585ns %2B189%25 432bytes %2B337%25 434bytes %2B333%25
PMMP(BINHEX) 32416ns %2B103%25 108684ns %2B189%25 432bytes %2B337%25 434bytes %2B333%25
SNBT 31342ns %2B100%25 57248ns %2B100%25 128bytes %2B100%25 130bytes %2B100%25
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

LIST ALL_TYPE serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 11103ns %2B130%25 35935ns %2B146%25 112bytes %2B175%25 624bytes %2B917%25
PMMP(BASE64) 11176ns %2B131%25 35560ns %2B145%25 152bytes %2B237%25 155bytes %2B227%25
PMMP(BINHEX) 13555ns %2B159%25 36283ns %2B148%25 152bytes %2B237%25 155bytes %2B227%25
SNBT 8511ns %2B100%25 24446ns %2B100%25 64bytes %2B100%25 68bytes %2B100%25
[
    [
        1b
    ], 
    [
        1s
    ], 
    [
        1
    ], 
    [
        1l
    ], 
    [
        1f
    ], 
    [
        1d
    ], 
    [
        "1"
    ], 
    [
        [B;49b]
    ], 
    [
        [I;1]
    ], 
    [
        []
    ], 
    [
        {}
    ]
]

COMPOUND EMPTY serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 1355ns %2B1194%25 2285ns %2B411%25 4bytes %2B200%25 22bytes %2B550%25
PMMP(BASE64) 1379ns %2B1215%25 2365ns %2B426%25 8bytes %2B400%25 10bytes %2B250%25
PMMP(BINHEX) 1378ns %2B1215%25 2359ns %2B425%25 8bytes %2B400%25 10bytes %2B250%25
SNBT 113ns %2B100%25 555ns %2B100%25 2bytes %2B100%25 4bytes %2B100%25
{}

COMPOUND 128_ITEM serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 93688ns %2B228%25 233949ns %2B227%25 790bytes %2B100%25 2856bytes %2B361%25
PMMP(BASE64) 89565ns %2B218%25 247896ns %2B241%25 1056bytes %2B134%25 1058bytes %2B134%25
PMMP(BINHEX) 90086ns %2B220%25 236842ns %2B230%25 1056bytes %2B134%25 1058bytes %2B134%25
SNBT 40946ns %2B100%25 102717ns %2B100%25 787bytes %2B100%25 789bytes %2B100%25
{0: {}, 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: {}, 107: {}, 108: {}, 109: {}, 110: {}, 111: {}, 112: {}, 113: {}, 114: {}, 115: {}, 116: {}, 117: {}, 118: {}, 119: {}, 120: {}, 121: {}, 122: {}, 123: {}, 124: {}, 125: {}, 126: {}, 127: {}}

COMPOUND 64_DEPTH serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 50302ns %2B108%25 124341ns %2B229%25 373bytes %2B121%25 1399bytes %2B451%25
PMMP(BASE64) 48273ns %2B104%25 135973ns %2B250%25 500bytes %2B162%25 502bytes %2B161%25
PMMP(BINHEX) 46239ns %2B100%25 123709ns %2B227%25 500bytes %2B162%25 502bytes %2B161%25
SNBT 47675ns %2B103%25 54284ns %2B100%25 308bytes %2B100%25 310bytes %2B100%25
{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: {}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

COMPOUND ALL_TYPE serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 12020ns %2B175%25 25547ns %2B129%25 158bytes %2B117%25 550bytes %2B364%25
PMMP(BASE64) 12027ns %2B175%25 27237ns %2B138%25 212bytes %2B157%25 215bytes %2B142%25
PMMP(BINHEX) 11966ns %2B174%25 25568ns %2B129%25 212bytes %2B157%25 215bytes %2B142%25
SNBT 6846ns %2B100%25 19694ns %2B100%25 135bytes %2B100%25 151bytes %2B100%25
{
    byte: 1b, 
    int: 1, 
    short: 1s, 
    long: 1l, 
    float: 1f, 
    double: 1d, 
    string: "1", 
    "array:byte": [B;49b], 
    "array:int": [I;1], 
    ":list:": [], 
    "\"compound\"": {}, 
    : {}
}

COMPOUND RPG_ITEM serialize-time deserialize-time serialized-size escaped-size
PMMP(BINARY) 12562ns %2B186%25 27441ns %2B172%25 231bytes %2B110%25 553bytes %2B246%25
PMMP(BASE64) 13991ns %2B207%25 27311ns %2B171%25 308bytes %2B147%25 310bytes %2B138%25
PMMP(BINHEX) 12579ns %2B186%25 28436ns %2B178%25 308bytes %2B147%25 310bytes %2B138%25
SNBT 6746ns %2B100%25 15916ns %2B100%25 212bytes %2B101%25 225bytes %2B100%25
{
    Count: 1b, 
    Slot: 12b, 
    Name: "minecraft:diamond_sword", 
    Damage: 0s, 
    tag: {
        rarity: "legendary", 
        itemType: "weapon", 
        stats: {
            attackDamage: 20, 
            criticalChance: 15f, 
            skill: "Dragon\u2019s Breath"
        }, 
        generatedBy: "GPT"
    }, 
    PMMPDataVersion: 1l
}