def main():
    if True:
        fig, axs = plt.subplots()
        axs.set_yscale('log')
        axs.set_xscale('log')
        (Plotter(
            MultiTimer([
                solution_justin,
                solution_ajneufeld,
                solution_josay,
                solution_rishav,
                solution_rishav_np,
            ])).repeat(10, 1, np.logspace(0, 2),
                       args_conv=int).min().plot(axs,
                                                 title='Comparison of Answers',
                                                 x_label='n'))
        fig.show()

    if True:
        output = None
        amount = 1000
        for fn in [
                solution_justin,
                solution_ajneufeld,
                solution_josay,
                solution_rishav,
                solution_rishav_np,
        ]:
            if output is None:
                output = fn(amount)
            elif output != fn(amount):
                print(fn)
def main():
    fig, axs = plt.subplots()
    axs.set_yscale('log')
    axs.set_xscale('log')
    (Plotter(
        MultiTimer([
            largest_orig,
            largest_orig_pretty,
            largest_no_max,
            largest_no_max_iter,
            largest_counter,
            largest_sort,
            largest_sort_semifunctional,
            largest_sort_functional,
            largest_sorted,
            largest_max_count,
        ])).repeat(
            10,
            10,
            np.logspace(0, 5),
            args_conv=lambda n: list(np.random.rand(int(n)))).min().plot(
                axs, title='Maximums'))
    fig.show()

    fig, axs = plt.subplots()
    axs.set_yscale('log')
    axs.set_xscale('log')
    (Plotter(
        MultiTimer([
            largest_orig_pretty,
            largest_sort,
            largest_max_count,
            largest_max_count_comprehension,
            largest_max_comprehension,
            largest_max_comprehension_once,
            largest_grijesh_chauhan,
        ])).repeat(
            10,
            10,
            np.logspace(0, 3),
            args_conv=lambda n: list(np.random.rand(int(n)))).min().plot(
                axs, title='Maximums SO comparison'))
    fig.show()
Exemplo n.º 3
0
def main():
    fig, axs = plt.subplots()
    axs.set_yscale('log')
    axs.set_xscale('log')
    (Plotter(MultiTimer([test_orig, test_peil, test_alain_t, test_peil_alain
                         ])).repeat(10,
                                    10,
                                    np.logspace(0, 5, num=50),
                                    args_conv=args_conv).min().plot(
                                        axs, x_label='len(nums)'))
    fig.show()
def test_all_plots():
    def args_conv(size):
        return se_code.final.available, size

    fig, axs = plt.subplots()
    # axs.set_yscale('log')
    # axs.set_xscale('log')
    (Plotter(MultiTimer([
        se_code.final.find_combs,
    ])).repeat(5, 5, range(0, 2001, 10),
               args_conv=args_conv).min().plot(axs, x_label='len(nums)'))
    fig.savefig('static/figs/final.png')
    fig.savefig('static/figs/final.svg')
def main():
    fig, axs = plt.subplots()
    axs.set_yscale('log')
    axs.set_xscale('log')
    (Plotter(
        MultiTimer([
            solution_justin,
            solution_justin_reverse,
            solution_justin_pre_computed,
            solution_justin_pre_computed_list,
        ])).repeat(10, 1, np.logspace(0, 2), args_conv=create_arg).min().plot(
            axs, title='Comparison of Loop Changes', x_label='dungeon size'))
    fig.show()

    fig, axs = plt.subplots()
    axs.set_yscale('log')
    axs.set_xscale('log')
    (Plotter(
        MultiTimer([
            solution_justin_pre_computed,
            solution_justin_inplace,
            solution_justin_no_guard,
            solution_peilonrayz,
        ])).repeat(10, 1, np.logspace(0, 2), args_conv=create_arg).min().plot(
            axs, title='Code Review Changes', x_label='dungeon size'))
    fig.show()

    fig, axs = plt.subplots()
    axs.set_yscale('log')
    axs.set_xscale('log')
    (Plotter(MultiTimer([
        solution_justin,
        solution_justin_no_guard,
    ])).repeat(10, 1, np.logspace(0, 2), args_conv=create_arg).min().plot(
        axs, title='Comparison of Original and Final', x_label='dungeon size'))
    fig.show()
def main():
    fig, axs = plt.subplots()
    axs.set_yscale('log')
    axs.set_xscale('log')
    (Plotter(
        MultiTimer([
            random_none,
            random_chunked_10,
            random_chunked_50,
            random_chunked_100,
            random_chunked_500,
        ])).repeat(5, 5, np.logspace(0, 5),
                   args_conv=lambda n: int(n)).min().plot(axs,
                                                          title='Randoms'))
    fig.show()
def test_without_aj():
    fig, axs = plt.subplots()
    axs.set_yscale('log')
    axs.set_xscale('log')
    (
        Plotter(MultiTimer([
            se_code.peilonrayz.display,
            se_code.maarten_fabre.display,
            se_code.andy.display,
        ]))
            .repeat(20, 20, np.logspace(0, 5), args_conv=lambda i: ['foo'] * int(i))
            .min()
            .plot(axs, x_label='len(flavours)')
    )
    fig.savefig('static/figs/plot.png')
    fig.savefig('static/figs/plot.svg')