def combine_result(old_results, new_result):
    """Adds a new result to the results JSON list; filters for duplicate entries and saves the best performing one"""

    # Loops over all existing results to test for already existing entries with these parameters
    for old_result in old_results:

        # Verify whether the results match
        equal = new_result["parameters"] == old_result["parameters"]

        # They match: keep only the one with the minimum execution time
        if equal:
            old_result["time"] = min(old_result["time"], new_result["time"])
            return old_results

    # No match found: append a new result
    old_results.append(new_result)
    return old_results