def comparison(): funcscale.function_list = [ primes_for, primes_while, ] funcscale.argument_list = [((10**i, ), {}) for i in range(7)] funcscale.compare()
def comparison(): # Create parameters. function_list = [ binary_search_tree.list_iterator, binary_search_tree.iterator, binary_search_tree.generator ] argument_list = [(([random.randint(0, 10**n - 1) for i in range(10**n)], ), {}) for n in range(6)] def setup(function, argument): value_list = funcscale.repr_argument(argument) return '\n'.join( ('from binary_search_tree import BinarySearchTree', 'from binary_search_tree import BinarySearchNode', 'from binary_search_tree import ' + function.__name__, 'bst = BinarySearchTree()', 'for value in ' + value_list + ':', ' bst.insert(value)', 'BinarySearchNode.__iter__ = ' + function.__name__)) def stmt(fucntion, argument): return '[value for value in bst]' # Set parameters. funcscale.function_list = function_list funcscale.argument_list = argument_list funcscale.stmt = stmt funcscale.setup = setup # Execute. funcscale.compare()
def comparison(): funcscale.function_list = [ primes, primes_fast, primes_dict, primes_ordered_dict ] funcscale.argument_list = [((10**i, ), {}) for i in range(2, 5)] funcscale.str_argument_list = [f'10**{i}' for i in range(2, 5)] funcscale.compare()
def comparison(): funcscale.function_list = [reverse, reverse_exception, reverse_function] funcscale.argument_list = [ (([random.randint(0, 10**n - 1) for i in range(10**n)], ), {}) for n in range(6) ] funcscale.compare()
def comparison(): funcscale.function_list = [ subtract_list_try_remove, subtract_list_for_if, subtract_list_while_if ] funcscale.argument_list = [ ((list1, list2), {}), ((list3, list4), {}), ((list5, list6), {}), ] funcscale.compare()
def comparison(): funcscale.function_list = [ _divisorize_pair, _divisorize_syntax, _divisorize_naive, ] funcscale.argument_list = [ ((2**2 * 3**2 * 5**2, ), {}), ((2**2 * 3**3 * 5**3, ), {}), ((2**2 * 3**3 * 5**4, ), {}), ((3313**2 * 3323**3, ), {}), ((3313**3 * 3323**4, ), {}), ((3313**3 * 3323**5, ), {}), ] funcscale.compare()
def comparison(): funcscale.function_list = [ for_statement, for_statement_speed_up, for_statement_list_comprehension, ] funcscale.argument_list = [((i, ), {}) for i in range(7)] return funcscale.compare()
def comparison(): function_list = [list_iterator, iterator, generator] argument_list = [(([None] * 10**n, ), {}) for n in range(6)] def setup(function, argument): return '\n'.join( ('from __main__ import ' + function.__name__, 'from __main__ import Container', 'container = Container' + funcscale.repr_argument(argument), 'Container.__iter__ = ' + function.__name__)) def stmt(fucntion, argument): return '[element for element in container]' funcscale.function_list = function_list funcscale.argument_list = argument_list funcscale.stmt = stmt funcscale.setup = setup funcscale.compare()
def comparison(): funcscale.function_list = [ multicative_list, for_statement, for_statement_list_comprehension, while_statement, while_statement_with_iterator, while_statement_with_iterator_optimized, ] funcscale.argument_list = [((10**i, ), {}) for i in range(4)] return funcscale.compare()
def comparison(): funcscale.function_list = [ subtract_list_try_remove, subtract_list_if_remove, subtract_list_for_if_del, subtract_list_while_if_pop, ] funcscale.argument_list = [ (([i for i in range(0, 1000)], [i for i in range(0, 1000)]), {}), (([i for i in range(0, 1000)], [i for i in range(999, -1, -1)]), {}), (([i for i in range(0, 1000)], [i for i in range(1000, 2000)]), {}), (([random.randint(0, 1000) for _ in range(1000)], [random.randint(0, 1000) for _ in range(1000)]), {}), ] funcscale.str_argument_list = [ '([i for i in range(0, 1000)], [i for i in range(0, 1000)])', '([i for i in range(0, 1000)], [i for i in range(999, -1, -1)])', '([i for i in range(0, 1000)], [i for i in range(1000, 2000)])', '([random.randint(0, 1000) for _ in range(1000)],' + '[random.randint(0, 1000) for _ in range(1000, 2000)])', ] funcscale.compare()
def comparison(): function_list = [next_condition, next_exception] argument_list = [((list(range(10**n)), ), {}) for n in range(7)] def setup(function, argument): return '\n'.join( ('from __main__ import ' + function.__name__, 'from __main__ import Reverse', 'Reverse.__next__ = ' + function.__name__, 'reverse = Reverse' + funcscale.repr_argument(argument))) def stmt(function, argument): return '[element for element in reverse]' # Set parameters. funcscale.function_list = function_list funcscale.argument_list = argument_list funcscale.stmt = stmt funcscale.setup = setup # Execute. funcscale.compare()
def comparison(): funcscale.function_list = [ while_statement_insert, while_statement_append, for_statement, for_statement_list_comprehension, filter_function, ] funcscale.argument_list = [ (([random.randint(0, 10**i - 1) for _ in range(10**i)], ), {}) for i in range(5) ] return funcscale.compare()
def comparison(): funcscale.function_list = [ prime_decomposition_for, prime_decomposition_for_itertools, prime_decomposition_while, ] funcscale.argument_list = [ ((2**3 * 3**12 * 5**7, ), {}), ((3313**3 * 3323**3, ), {}), ((9973**5 * 9932**3 * 9901**2, ), {}), ((9973**5 * 9932**3 * 9901**2, ), {}), ((111869**3 * 128461**2, ), {}), ((111869**3 * 128461**2 * 188459**3, ), {}), ] return funcscale.compare()
def comparison(): funcscale.function_list = [ for_statement_append, list_comprehension, while_statement, for_statement_del, ] funcscale.argument_list = [ (([random.randint(0, 10**i - 1) for _ in range(10**i)], ), {}) for i in range(6) ] funcscale.str_argument_list = [ f'[random.randint(0, 10**i - 1) for _ in range(10**{i})]' for i in range(6) ] return funcscale.compare()
def comparison(): funcscale.function_list = [primes, primes_fast, primes_ordered_dict] funcscale.argument_list = [((10**i, ), {}) for i in range(1, 7)] funcscale.compare()