From 721ec274d30d8680fa38154598388dfd7d1e6a72 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Mon, 9 Sep 2019 22:11:30 -0400 Subject: [PATCH] Code to parse the results Future reference: use JSON --- parse_results.py | 58 +++++++++++++++++++++++ shootout.csv | 121 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100755 parse_results.py create mode 100644 shootout.csv diff --git a/parse_results.py b/parse_results.py new file mode 100755 index 0000000..8ba2c12 --- /dev/null +++ b/parse_results.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +import pandas as pd + +def parse_block(lines, run_format, run_date): + # Future reference: output benchmark results in a format + # that doesn't require extra code to read + return { + 'run_date': run_date, + 'run_format' : run_format, + 'protocol' : lines[0].split(' total')[0], + 'total_secs' : int(lines[0].split('=')[1][:-2]), + 'serialize_50_nanos' : int(lines[2].split('=')[1][:-3]), + 'serialize_99_nanos' : int(lines[3].split('=')[1][:-3]), + 'serialize_999_nanos' : int(lines[4].split('=')[1][:-3]), + 'deserialize_50_nanos' : int(lines[5].split('=')[1][:-3]), + 'deserialize_99_nanos' : int(lines[6].split('=')[1][:-3]), + 'deserialize_999_nanos' : int(lines[7].split('=')[1][:-3]), + 'serialize_total_nanos' : int(lines[8].split('=')[1][:-3]), + 'deserialize_total_nanos' : int(lines[9].split('=')[1][:-3]), + } + + +def main(filename: str, run_format: str): + records = [] + run_count = 10 + + with open(filename, 'r') as handle: + lines = handle.readlines() + + for i in range(run_count): + num_blocks = 4 + block_len = 12 + run_date = lines[i * num_blocks * block_len + i].split('_')[2] + + for block in range(num_blocks): + lower_block = i * block_len * num_blocks + block * block_len + i + 1 + upper_block = i * block_len * num_blocks + block * block_len + block_len + i + 1 + + inner_lines = lines[lower_block:upper_block] + rec = parse_block(inner_lines, run_format, run_date) + records.append(rec) + + return records + + +if __name__ == '__main__': + all_records = [] + + runs = [ + ('shootout_normal.txt', ''), + ('shootout_taskset.txt', ''), + ('shootout_nice.txt', '') + ] + for fname, run_format in runs: + for record in main(fname, run_format): + all_records.append(record) + + pd.DataFrame.from_records(all_records).to_csv('shootout.csv') diff --git a/shootout.csv b/shootout.csv new file mode 100644 index 0000000..fbcc5d3 --- /dev/null +++ b/shootout.csv @@ -0,0 +1,121 @@ +,deserialize_50_nanos,deserialize_999_nanos,deserialize_99_nanos,deserialize_total_nanos,protocol,run_date,run_format,serialize_50_nanos,serialize_999_nanos,serialize_99_nanos,serialize_total_nanos,total_secs +0,349,1527,695,11966582359,Cap'n Proto Unpacked,20190903,,277,2847,1847,10610112294,133 +1,515,2239,1019,16896101525,Cap'n Proto Packed,20190903,,419,2991,1831,15139942312,146 +2,159,931,387,5547316870,Flatbuffers,20190903,,351,3455,2127,14112670600,134 +3,98,551,238,3425356927,SBE,20190903,,94,2447,1551,4012425273,122 +4,341,1071,547,7944038397,Cap'n Proto Unpacked,20190904,,252,2719,1783,7030607508,94 +5,559,2303,1223,14483817329,Cap'n Proto Packed,20190904,,397,2879,1663,10127533459,106 +6,198,823,387,4768337696,Flatbuffers,20190904,,349,3231,2079,9878993693,97 +7,91,385,179,2209115647,SBE,20190904,,86,2431,1439,2671614209,86 +8,345,1263,563,9460799943,Cap'n Proto Unpacked,20190905,,261,3727,1927,9057074813,126 +9,485,2175,995,14340697223,Cap'n Proto Packed,20190905,,401,2991,1759,11997695361,129 +10,144,699,289,4126360715,Flatbuffers,20190905,,371,3423,2271,12366033351,117 +11,129,595,257,3651287108,SBE,20190905,,100,2511,1463,3574370390,107 +12,351,1583,815,10076105266,Cap'n Proto Unpacked,20190906,,252,2735,1807,7625656659,104 +13,463,2287,1183,13154726633,Cap'n Proto Packed,20190906,,393,2879,1711,10913694372,112 +14,200,1087,559,5227382663,Flatbuffers,20190906,,349,3631,2239,10932412894,108 +15,138,595,285,3672591060,SBE,20190906,,88,2991,1479,3092868157,100 +16,351,1487,687,11946201560,Cap'n Proto Unpacked,20190903,,252,2767,1807,9905662890,132 +17,511,2223,1159,17562039278,Cap'n Proto Packed,20190903,,401,2975,1743,14506234496,146 +18,158,891,379,5496091881,Flatbuffers,20190903,,359,3503,2271,14348322976,135 +19,116,607,267,4015318899,SBE,20190903,,94,2495,1455,4062744461,123 +20,347,1375,807,8665543455,Cap'n Proto Unpacked,20190904,,321,2831,1863,8610091709,108 +21,531,1847,959,12572449473,Cap'n Proto Packed,20190904,,451,2991,1759,11555620464,118 +22,157,667,307,3832450768,Flatbuffers,20190904,,339,3663,2255,9894312928,111 +23,100,421,200,2446297310,SBE,20190904,,79,2463,1567,2554367494,101 +24,319,1207,555,9138598200,Cap'n Proto Unpacked,20190905,,275,2815,1831,8939091362,123 +25,551,2367,1215,16639409024,Cap'n Proto Packed,20190905,,411,2879,1687,12171151368,133 +26,161,787,325,4626524565,Flatbuffers,20190905,,357,3311,2095,11783649631,114 +27,96,461,204,2778757729,SBE,20190905,,89,2399,1527,3209222021,104 +28,323,1167,547,8494076435,Cap'n Proto Unpacked,20190906,,269,3295,1863,8265869438,105 +29,671,2719,1559,18287756861,Cap'n Proto Packed,20190906,,411,3023,1671,11637011289,120 +30,152,731,307,4081200595,Flatbuffers,20190906,,341,3615,2223,10729723888,107 +31,99,475,208,2684279931,SBE,20190906,,86,2415,1535,2868258377,97 +32,367,1847,827,13343502076,Cap'n Proto Unpacked,20190903,,265,2831,1839,10386891305,139 +33,547,2591,1247,19641152323,Cap'n Proto Packed,20190903,,395,2895,1767,14225137874,147 +34,160,935,391,5577542222,Flatbuffers,20190903,,345,3391,2095,13876256852,133 +35,96,531,229,3335479178,SBE,20190903,,87,2415,1535,3777230114,121 +36,419,1263,771,9523533769,Cap'n Proto Unpacked,20190904,,275,2783,1791,7606033442,106 +37,531,1831,975,12565102713,Cap'n Proto Packed,20190904,,411,2847,1679,10362096764,111 +38,199,1047,465,5195965525,Flatbuffers,20190904,,359,3103,1999,10037401358,99 +39,97,415,197,2388270596,SBE,20190904,,101,2431,1543,3010075554,90 +40,411,1847,835,13662693913,Cap'n Proto Unpacked,20190903,,311,3231,1887,12008667500,147 +41,539,2783,1247,19133536343,Cap'n Proto Packed,20190903,,437,2991,1839,15756665020,153 +42,177,1223,483,6705480338,Flatbuffers,20190903,,365,3535,2207,14619297706,153 +43,95,523,227,3323421801,SBE,20190903,,93,2431,1543,4014654531,137 +44,355,1263,663,8749249383,Cap'n Proto Unpacked,20190904,,261,2783,1799,7334251703,107 +45,571,2143,1215,14809332792,Cap'n Proto Packed,20190904,,393,2831,1655,9972659997,113 +46,162,683,313,3936594560,Flatbuffers,20190904,,357,3279,2111,10168437728,101 +47,151,611,299,3666207674,SBE,20190904,,81,2367,1503,2511717496,89 +48,345,1287,567,9474129471,Cap'n Proto Unpacked,20190905,,265,2735,1775,8653449895,111 +49,551,2351,1207,16626965108,Cap'n Proto Packed,20190905,,401,2847,1695,11925598212,121 +50,155,771,319,4480641799,Flatbuffers,20190905,,349,3199,2007,11562377913,110 +51,104,493,215,2981546087,SBE,20190905,,87,2399,1519,3131830501,101 +52,351,1319,663,9411040906,Cap'n Proto Unpacked,20190906,,261,2735,1775,7785262082,112 +53,551,2111,1191,15196818975,Cap'n Proto Packed,20190906,,399,2879,1695,11011660167,122 +54,165,747,315,4347788394,Flatbuffers,20190906,,363,3375,2223,11240171144,108 +55,153,659,301,4042648798,SBE,20190906,,106,2399,1495,3274903555,96 +56,343,1431,675,11292502069,Cap'n Proto Unpacked,20190903,,265,2719,1767,10207024166,131 +57,543,2783,1255,19494903058,Cap'n Proto Packed,20190903,,405,2895,1759,14496308239,146 +58,160,887,381,5542672464,Flatbuffers,20190903,,345,3439,2111,13951948603,134 +59,124,655,301,4269810226,SBE,20190903,,88,2431,1535,3808133361,122 +60,333,1047,543,7821872227,Cap'n Proto Unpacked,20190904,,261,2735,1767,7248717722,103 +61,563,2287,1215,14572907496,Cap'n Proto Packed,20190904,,399,2815,1655,10081007475,113 +62,166,739,319,4034325303,Flatbuffers,20190904,,351,3103,1999,9859713318,98 +63,103,429,203,2500242780,SBE,20190904,,91,2431,1551,2787990432,89 +64,429,1615,811,11925383968,Cap'n Proto Unpacked,20190905,,267,2735,1791,8631754029,123 +65,527,2039,963,14608775795,Cap'n Proto Packed,20190905,,407,2927,1703,12208218293,131 +66,163,787,325,4655719250,Flatbuffers,20190905,,349,3375,2111,11802920170,116 +67,100,481,219,2895718831,SBE,20190905,,94,2415,1535,3270270038,103 +68,365,1567,815,10514175663,Cap'n Proto Unpacked,20190906,,273,2751,1799,8160010614,106 +69,559,2271,1215,15874743725,Cap'n Proto Packed,20190906,,419,2895,1719,11487079439,115 +70,165,775,317,4374429819,Flatbuffers,20190906,,345,3167,2023,10586794626,103 +71,99,473,203,2680676860,SBE,20190906,,83,2431,1543,2792745397,94 +72,417,1799,835,13819775289,Cap'n Proto Unpacked,20190903,,271,2799,1815,10558884147,136 +73,535,2735,1247,19092523409,Cap'n Proto Packed,20190903,,407,2927,1759,14590143184,145 +74,158,891,379,5491117728,Flatbuffers,20190903,,347,3455,2143,14065562298,133 +75,107,567,253,3682398810,SBE,20190903,,88,2415,1535,3766980703,119 +76,425,1295,787,9814887167,Cap'n Proto Unpacked,20190904,,267,2783,1799,7452298206,98 +77,563,2239,1215,14596410425,Cap'n Proto Packed,20190904,,403,2863,1687,10230547982,105 +78,153,691,309,3778839884,Flatbuffers,20190904,,347,3119,2015,9807013100,95 +79,110,555,279,2862672888,SBE,20190904,,86,2431,1543,2657393550,87 +80,415,1839,839,13929975253,Cap'n Proto Unpacked,20190903,,263,2767,1799,10314074736,137 +81,523,2607,1223,18034533086,Cap'n Proto Packed,20190903,,405,2943,1719,14577451489,146 +82,163,915,397,5613752646,Flatbuffers,20190903,,349,3471,2191,14111767849,135 +83,106,571,254,3657691168,SBE,20190903,,86,2415,1535,3744147119,122 +84,437,1503,815,10452679105,Cap'n Proto Unpacked,20190904,,265,2767,1799,7374091679,98 +85,575,2079,1207,14489039861,Cap'n Proto Packed,20190904,,407,2879,1695,10279273781,105 +86,190,799,379,4612465828,Flatbuffers,20190904,,343,3215,2079,9728396384,96 +87,121,497,242,2940937433,SBE,20190904,,80,2415,1527,2510440809,86 +88,359,1327,671,10401730670,Cap'n Proto Unpacked,20190905,,277,2799,1807,9021818184,123 +89,501,2007,847,14080786562,Cap'n Proto Packed,20190905,,419,2911,1703,12487871900,131 +90,164,839,333,4714839698,Flatbuffers,20190905,,347,3311,2095,11654838944,117 +91,108,523,232,3102397000,SBE,20190905,,89,2415,1527,3163192287,104 +92,435,1511,811,11234936096,Cap'n Proto Unpacked,20190906,,275,2783,1815,8258091825,108 +93,551,2415,1215,15482469236,Cap'n Proto Packed,20190906,,425,2895,1719,11617511194,113 +94,154,715,307,4110084207,Flatbuffers,20190906,,357,3167,2023,10867054490,104 +95,157,683,303,4013780098,SBE,20190906,,87,2415,1543,2917946618,96 +96,329,1407,663,11105194713,Cap'n Proto Unpacked,20190903,,267,2783,1815,10481468753,134 +97,543,2447,1215,19239676625,Cap'n Proto Packed,20190903,,409,2943,1735,14668173163,147 +98,227,1335,535,7681520232,Flatbuffers,20190903,,359,3439,2127,14342073477,138 +99,150,835,365,5007300517,SBE,20190903,,87,2415,1535,3745348115,122 +100,353,1143,651,8586859892,Cap'n Proto Unpacked,20190904,,263,2751,1783,7275954790,103 +101,543,2319,1215,14181076851,Cap'n Proto Packed,20190904,,401,2863,1679,10154490763,112 +102,157,707,313,3869660411,Flatbuffers,20190904,,365,3135,2023,10184293836,98 +103,94,407,182,2299304629,SBE,20190904,,101,2431,1543,2983513581,89 +104,363,1671,815,11238631450,Cap'n Proto Unpacked,20190905,,269,2831,1839,8809180619,116 +105,543,2175,1167,15986554389,Cap'n Proto Packed,20190905,,403,2991,1775,12190582659,123 +106,159,819,325,4617074632,Flatbuffers,20190905,,351,3423,2223,11833183034,114 +107,95,471,208,2748694747,SBE,20190905,,92,2447,1559,3253997607,101 +108,349,1191,647,9126042141,Cap'n Proto Unpacked,20190906,,267,2783,1791,8170927417,105 +109,527,1879,943,13464407502,Cap'n Proto Packed,20190906,,407,2911,1719,11391630393,113 +110,184,847,383,4931924345,Flatbuffers,20190906,,351,3359,2111,10944822734,106 +111,109,499,222,2910840935,SBE,20190906,,90,2431,1551,2977013961,94 +112,341,1383,631,11190407596,Cap'n Proto Unpacked,20190903,,281,3247,1911,11089916344,149 +113,547,2767,1239,19656071401,Cap'n Proto Packed,20190903,,415,2911,1759,14778485846,158 +114,159,927,385,5527869809,Flatbuffers,20190903,,355,3535,2239,14314948129,138 +115,113,595,263,3931456041,SBE,20190903,,83,2415,1527,3686875885,125 +116,343,1351,799,8545961454,Cap'n Proto Unpacked,20190904,,265,2751,1791,7373805590,96 +117,489,1751,831,11901248560,Cap'n Proto Packed,20190904,,407,2895,1703,10433674131,104 +118,153,659,301,3751631639,Flatbuffers,20190904,,347,3263,2127,9952999141,97 +119,97,411,196,2371261873,SBE,20190904,,78,2415,1535,2466437511,86