@@ -8,7 +8,6 @@ import os
88import sys
99
1010from tabulate import tabulate
11- import numpy as np
1211import matplotlib .pyplot as plt
1312
1413LIBRARIES = ('orjson' , 'ujson' , 'rapidjson' , 'json' )
@@ -46,37 +45,6 @@ def box(obj):
4645 plt .savefig ('doc/{}.png' .format (group .replace (' ' , '_' ).replace ('.json' , '' )))
4746 plt .close ()
4847
49- def bar (obj ):
50- res = {key : [] for key in LIBRARIES }
51- groups = set ()
52- for group , val in sorted (obj .items ()):
53- for lib in LIBRARIES :
54- res [lib ].append (np .median (val [lib ]['data' ]))
55- groups .add (group )
56-
57- groups = list (reversed (sorted (list (groups ))))
58-
59- fig , ax = plt .subplots ()
60- index = np .arange (len (groups ))
61- bar_width = 0.2
62- opacity = 0.8
63-
64- plt .ylabel ('milliseconds' )
65- plt .xticks (index + bar_width , [each .split (' ' )[0 ] for each in groups ])
66- plt .legend ()
67-
68- for (idx , lib ) in enumerate (LIBRARIES ):
69- plt .bar (
70- index + (idx * bar_width ),
71- res [lib ],
72- bar_width ,
73- alpha = opacity ,
74- color = COLOR [idx ],
75- label = lib ,
76- )
77- plt .tight_layout ()
78- plt .show ()
79-
8048def tab (obj ):
8149 buf = io .StringIO ()
8250 headers = ('Library' , 'Median (milliseconds)' , 'Operations per second' , 'Relative (latency)' )
@@ -106,5 +74,5 @@ def tab(obj):
10674try :
10775 locals ()[sys .argv [1 ]](aggregate ())
10876except KeyError :
109- sys .stderr .write ("usage: graph (box|bar| tab)\n " )
77+ sys .stderr .write ("usage: graph (box|tab)\n " )
11078 sys .exit (1 )
0 commit comments