benchmark/analysis.py
def compare_2_programs(dfs_dict: Dict[str, pd.DataFrame], program_1: str, program_2: str) -> pd.DataFrame:
    """
    Compare 2 programs, putting in evidence their difference in runtime execution and how much the 2nd program
    improves the execution time compared to the 1st program.
    :param dfs_dict: map of DataFrames minimized wrt to column 'ms'
    :param program_1: name of the 1st program to compare
    :param program_2: name of the 2nd program to compare
    :return: new DataFrame containing the comparison information between the given two programs
    """

    # subset of dfs_dict containing only the list of dataframes related to program_1 and program_2
    dfs_filter: Dict[str, pd.DataFrame] = dict((k, v) for k, v in dfs_dict.items() if k in [program_1, program_2])
    dfs_valid: List[pd.DataFrame] = [dfs_filter[program] for program in [program_1, program_2]]

    # comparison DataFrame columns
    columns = ['8k', '10k', '20k', '40k', '80k', '100k']

    # compute rows of program_1 and program_2
    program_rows_np = np.asarray(create_list_of_ms_at_row(dfs_valid, columns), dtype=np.double)

    # compute difference row
    diff_np = program_rows_np[0] - program_rows_np[1]

    # compute improvement row (expressed as a percentage number)
    improvement_percentage = np.around(100 * diff_np / program_rows_np[0], decimals=N_DECIMALS_PERCENTAGE).tolist()

    # remove numpy wrapper
    program_1_row, program_2_row = program_rows_np.tolist()
    diff = diff_np.tolist()

    data = [
        [program_1, *program_1_row],
        [program_2, *program_2_row],
        ['Difference', *diff],
        ['Improvement %', *improvement_percentage]
    ]

    return pd.DataFrame(data, columns=['', *columns])

    Compare 2 programs, putting in evidence their difference in runtime execution and how much the 2nd program
    improves the execution time compared to the 1st program.
    :param dfs_dict: map of DataFrames minimized wrt to column 'ms'
    :param program_1: name of the 1st program to compare
    :param program_2: name of the 2nd program to compare
    :return: new DataFrame containing the comparison information between the given two programs
    
Compare 2 programs, putting in evidence their difference in runtime execution and how much the 2nd program
improves the execution time compared to the 1st program.
Compare 2 programs putting in evidence their difference in runtime execution and how much the 2nd program improves the execution time compared to the 1st program .
def compare_2_programs(dfs_dict: Dict[str, pd.DataFrame], program_1: str, program_2: str) -> pd.DataFrame:
    dfs_filter: Dict[str, pd.DataFrame] = dict((k, v) for k, v in dfs_dict.items() if k in [program_1, program_2])
    dfs_valid: List[pd.DataFrame] = [dfs_filter[program] for program in [program_1, program_2]]
    columns = ['8k', '10k', '20k', '40k', '80k', '100k']
    program_rows_np = np.asarray(create_list_of_ms_at_row(dfs_valid, columns), dtype=np.double)
    diff_np = program_rows_np[0] - program_rows_np[1]
    improvement_percentage = np.around(100 * diff_np / program_rows_np[0], decimals=N_DECIMALS_PERCENTAGE).tolist()
    program_1_row, program_2_row = program_rows_np.tolist()
    diff = diff_np.tolist()
    data = [
        [program_1, *program_1_row],
        [program_2, *program_2_row],
        ['Difference', *diff],
        ['Improvement %', *improvement_percentage]
    ]
    return pd.DataFrame(data, columns=['', *columns])
def compare_2_programs ( dfs_dict : Dict [ str , pd . DataFrame ] , program_1 : str , program_2 : str ) -> pd . DataFrame : dfs_filter : Dict [ str , pd . DataFrame ] = dict ( ( k , v ) for k , v in dfs_dict . items ( ) if k in [ program_1 , program_2 ] ) dfs_valid : List [ pd . DataFrame ] = [ dfs_filter [ program ] for program in [ program_1 , program_2 ] ] columns = [ '8k' , '10k' , '20k' , '40k' , '80k' , '100k' ] program_rows_np = np . asarray ( create_list_of_ms_at_row ( dfs_valid , columns ) , dtype = np . double ) diff_np = program_rows_np [ 0 ] - program_rows_np [ 1 ] improvement_percentage = np . around ( 100 * diff_np / program_rows_np [ 0 ] , decimals = N_DECIMALS_PERCENTAGE ) . tolist ( ) program_1_row , program_2_row = program_rows_np . tolist ( ) diff = diff_np . tolist ( ) data = [ [ program_1 , * program_1_row ] , [ program_2 , * program_2_row ] , [ 'Difference' , * diff ] , [ 'Improvement %' , * improvement_percentage ] ] return pd . DataFrame ( data , columns = [ '' , * columns ] )
Compare 2 programs, putting in evidence their difference in runtime execution and how much the 2nd program
improves the execution time compared to the 1st program.
Compare 2 programs putting in evidence their difference in runtime execution and how much the 2nd program improves the execution time compared to the 1st program .
"""
    Compare 2 programs, putting in evidence their difference in runtime execution and how much the 2nd program
    improves the execution time compared to the 1st program.
    :param dfs_dict: map of DataFrames minimized wrt to column 'ms'
    :param program_1: name of the 1st program to compare
    :param program_2: name of the 2nd program to compare
    :return: new DataFrame containing the comparison information between the given two programs
    """ # subset of dfs_dict containing only the list of dataframes related to program_1 and program_2
 # comparison DataFrame columns
 # compute rows of program_1 and program_2
 # compute difference row
 # compute improvement row (expressed as a percentage number)
 # remove numpy wrapper

new DataFrame containing the comparison information between the given two programs
new DataFrame containing the comparison information between the given two programs
dfs_dict
Dict[str, pd.DataFrame]
map of DataFrames minimized wrt to column 'ms'
map of DataFrames minimized wrt to column ' ms '
program_1
str
name of the 1st program to compare
name of the 1st program to compare
program_2
str
name of the 2nd program to compare
name of the 2nd program to compare