コード例 #1
0
def list_benchmark():
    # list
    list_results = list()

    list_results_manager = ResultsManager()
    list_results_manager.collection_name = 'List'
    list_results_manager.number_of_operations = num_of_operations

    for i in range(0, samples):
        print('Progress: ' + str(i) + '/' + str(samples))
        benchmark = Benchmark(ListTest(num_of_operations))
        list_results.append(benchmark.perform_all_tests())

    list_results_manager.save_to_csv(list_results, 'Python_ListTest.csv')
コード例 #2
0
def dict_benchmark():
    # dictionary
    dictionary_results = list()

    dict_results_manager = ResultsManager()
    dict_results_manager.collection_name = 'Dictionary'
    dict_results_manager.number_of_operations = num_of_operations

    for i in range(0, samples):
        print('Progress: ' + str(i) + '/' + str(samples))
        benchmark = Benchmark(DictionaryTest(num_of_operations))
        dictionary_results.append(benchmark.perform_all_tests())

    dict_results_manager.save_to_csv(dictionary_results,
                                     'Python_DictionaryTest.csv')