@@ -309,9 +309,20 @@ def get_array(size: int) -> np.ndarray:
309309 return array
310310
311311
312+ class FFUInt32 (FixtureFactory ):
313+ NAME = "uint32"
314+ SORT = 3
315+
316+ @staticmethod
317+ def get_array (size : int ) -> np .ndarray :
318+ array = np .arange (INT_START , INT_START + size , dtype = np .uint32 )
319+ array .flags .writeable = False
320+ return array
321+
322+
312323class FFFloat64 (FixtureFactory ):
313324 NAME = "float64"
314- SORT = 3
325+ SORT = 4
315326
316327 @staticmethod
317328 def get_array (size : int ) -> np .ndarray :
@@ -322,7 +333,7 @@ def get_array(size: int) -> np.ndarray:
322333
323334class FFFloat32 (FixtureFactory ):
324335 NAME = "float32"
325- SORT = 4
336+ SORT = 5
326337
327338 @staticmethod
328339 def get_array (size : int ) -> np .ndarray :
@@ -331,37 +342,112 @@ def get_array(size: int) -> np.ndarray:
331342 return array
332343
333344
334- class FFString (FixtureFactory ):
335- NAME = "string"
345+ def get_string_array (size : int , char_count : int , kind : str ) -> str :
346+ fmt = f'-<{ char_count } '
347+ array = np .array (
348+ [f'{ hex (e ) * (char_count // 8 )} ' .format (fmt ) for e in range (INT_START , INT_START + size )],
349+ dtype = f'{ kind } { char_count } ' )
350+ array .flags .writeable = False
351+ return array
352+
353+ class FFU8 (FixtureFactory ):
354+ NAME = "U8"
336355 SORT = 6
337356
338357 @staticmethod
339358 def get_array (size : int ) -> np .ndarray :
340- array = np .array ([hex (e ) for e in range (size )])
341- array .flags .writeable = False
342- return array
343-
359+ return get_string_array (size , 8 , 'U' )
344360
345- class FFString4x (FixtureFactory ):
346- NAME = "string 4x "
361+ class FFU16 (FixtureFactory ):
362+ NAME = "U16 "
347363 SORT = 7
348364
349365 @staticmethod
350366 def get_array (size : int ) -> np .ndarray :
351- array = np .array ([hex (e ) * 4 for e in range (size )])
352- array .flags .writeable = False
353- return array
367+ return get_string_array (size , 16 , 'U' )
354368
355369
356- class FFBytes (FixtureFactory ):
357- NAME = "bytes "
370+ class FFU32 (FixtureFactory ):
371+ NAME = "U32 "
358372 SORT = 8
359373
360374 @staticmethod
361375 def get_array (size : int ) -> np .ndarray :
362- array = np .array ([bytes (hex (e ), encoding = "utf-8" ) for e in range (size )])
363- array .flags .writeable = False
364- return array
376+ return get_string_array (size , 32 , 'U' )
377+
378+
379+ class FFU64 (FixtureFactory ):
380+ NAME = "U64"
381+ SORT = 9
382+
383+ @staticmethod
384+ def get_array (size : int ) -> np .ndarray :
385+ return get_string_array (size , 64 , 'U' )
386+
387+
388+ class FFU128 (FixtureFactory ):
389+ NAME = "U128"
390+ SORT = 10
391+
392+ @staticmethod
393+ def get_array (size : int ) -> np .ndarray :
394+ return get_string_array (size , 128 , 'U' )
395+
396+
397+ class FFS8 (FixtureFactory ):
398+ NAME = "S8"
399+ SORT = 11
400+
401+ @staticmethod
402+ def get_array (size : int ) -> np .ndarray :
403+ return get_string_array (size , 8 , 'S' )
404+
405+ class FFS16 (FixtureFactory ):
406+ NAME = "S16"
407+ SORT = 12
408+
409+ @staticmethod
410+ def get_array (size : int ) -> np .ndarray :
411+ return get_string_array (size , 16 , 'S' )
412+
413+
414+ class FFS32 (FixtureFactory ):
415+ NAME = "S32"
416+ SORT = 13
417+
418+ @staticmethod
419+ def get_array (size : int ) -> np .ndarray :
420+ return get_string_array (size , 32 , 'S' )
421+
422+
423+ class FFS64 (FixtureFactory ):
424+ NAME = "S64"
425+ SORT = 14
426+
427+ @staticmethod
428+ def get_array (size : int ) -> np .ndarray :
429+ return get_string_array (size , 64 , 'S' )
430+
431+ class FFS128 (FixtureFactory ):
432+ NAME = "S128"
433+ SORT = 15
434+
435+ @staticmethod
436+ def get_array (size : int ) -> np .ndarray :
437+ return get_string_array (size , 128 , 'S' )
438+
439+
440+
441+
442+ # class FFBytes(FixtureFactory):
443+ # NAME = "bytes"
444+ # SORT = 8
445+
446+ # @staticmethod
447+ # def get_array(size: int) -> np.ndarray:
448+ # array = np.array([bytes(hex(e), encoding="utf-8") for e in range(INT_START, INT_START + size)])
449+ # array.flags.writeable = False
450+ # return array
365451
366452
367453class FFObject (FixtureFactory ):
@@ -390,19 +476,28 @@ def get_versions() -> str:
390476
391477
392478CLS_FF = (
393- FFInt32 ,
394- FFInt64 ,
395- FFUInt64 ,
396- FFFloat64 ,
397- FFString ,
398- FFString4x ,
399- FFBytes ,
479+ # FFInt32,
480+ # FFInt64,
481+ # FFUInt32,
482+ # FFUInt64,
483+ # FFFloat64,
484+ FFU8 ,
485+ FFU16 ,
486+ FFU32 ,
487+ FFU64 ,
488+ FFU128 ,
489+
490+ FFS8 ,
491+ FFS16 ,
492+ FFS32 ,
493+ FFS64 ,
494+ FFS128 ,
400495 # FFObject,
401496)
402497FF_ORDER = [f .NAME for f in sorted (CLS_FF , key = lambda ff : ff .SORT )]
403498
404499# -------------------------------------------------------------------------------
405- NUMBER = 2
500+ NUMBER = 20
406501
407502from itertools import product
408503
@@ -452,24 +547,33 @@ def plot_performance(frame, suffix: str = ""):
452547 ax .set_title (title , fontsize = 6 )
453548 ax .set_box_aspect (0.8 )
454549 time_max = fixture ["time" ].max ()
455- ax . set_yticks ([ 0 , time_max * 0.5 , time_max ] )
456- ax . set_yticklabels (
457- [
550+ time_min = fixture [ "time" ]. min ( )
551+ y_ticks = [ 0 , time_min , time_max * 0.5 , time_max ]
552+ y_labels = [
458553 "" ,
554+ seconds_to_display (time_min ),
459555 seconds_to_display (time_max * 0.5 ),
460556 seconds_to_display (time_max ),
461- ],
462- fontsize = 6 ,
463- )
557+ ]
558+ if time_min > time_max * 0.25 :
559+ # remove the min if it is greater than quarter
560+ y_ticks .pop (1 )
561+ y_labels .pop (1 )
562+
563+ ax .set_yticks (y_ticks )
564+ ax .set_yticklabels (y_labels , fontsize = 4 )
464565 # ax.set_xticks(x, names_display, rotation='vertical')
465566 ax .tick_params (
466567 axis = "x" ,
467- which = "both" ,
468568 bottom = False ,
469- top = False ,
470569 labelbottom = False ,
471570 )
472-
571+ ax .tick_params (
572+ axis = "y" ,
573+ length = 2 ,
574+ width = .5 ,
575+ pad = 1 ,
576+ )
473577 fig .set_size_inches (9 , 3 ) # width, height
474578 fig .legend (post , names_display , loc = "center right" , fontsize = 6 )
475579 # horizontal, vertical
@@ -483,7 +587,7 @@ def plot_performance(frame, suffix: str = ""):
483587 right = 0.85 ,
484588 top = 0.80 ,
485589 wspace = 1.0 , # width
486- hspace = 0.2 ,
590+ hspace = 0.4 ,
487591 )
488592 # plt.rcParams.update({'font.size': 22})
489593 plt .savefig (fp , dpi = 300 )
0 commit comments