Example #1
0
def plot_index_size():
    compile_command = compile_base_command + " " + cpp_ipmt_source
    run(compile_command, print_output=True)

    for textfile_name in textfiles_names:
        textfile_path = textfiles_dir + textfile_name
        textfile_idx_path = textfiles_dir + textfile_name + ".idx"

        plot_values = []
        plot_labels = []
        for compression_algorithm in compression_algorithms:
            for index_algorithm in index_algorithms:
                plot_labels += [compression_algorithm + '-' + index_algorithm]

        for compression_algorithm in compression_algorithms:
            for index_algorithm in index_algorithms:
                index_command = "./a.out index -v %s --compression=%s --indextype=%s" % (
                    textfile_path, compression_algorithm, index_algorithm)

                run(index_command)
                index_size = os.path.getsize(textfile_idx_path)
                plot_values += [index_size]

        PlotUtils.bar_plot(plot_values=plot_values,
                           plot_labels=plot_labels,
                           colors=colors,
                           ylabel="size in bytes",
                           title="Index size of " + textfile_name,
                           save_filename='plots/index-size-' + textfile_name)
Example #2
0
def plot_index_time():
    compile_command = compile_base_command + " " + cpp_ipmt_source
    run(compile_command, print_output=True)

    for textfile_name in textfiles_names:
        textfile_path = textfiles_dir + textfile_name

        plot_values = []
        plot_labels = []
        for compression_algorithm in compression_algorithms:
            for index_algorithm in index_algorithms:
                plot_labels += [compression_algorithm + '-' + index_algorithm]

        for compression_algorithm in compression_algorithms:
            for index_algorithm in index_algorithms:
                index_command = "./a.out index -v %s --compression=%s --indextype=%s" % (
                    textfile_path, compression_algorithm, index_algorithm)

                r = functools.partial(run, index_command, print_output=True)
                run_time = get_run_time(r, runs=num_of_runs)

                plot_values += [run_time]
                # plot_data[textfile_name] += [gzip_compressed_size]

        PlotUtils.bar_plot(plot_values=plot_values,
                           plot_labels=plot_labels,
                           colors=colors,
                           ylabel="time in seconds",
                           title="Index time of " + textfile_name,
                           save_filename='plots/index-time-' + textfile_name)
Example #3
0
def plot_decompression_time():
    compile_command = compile_base_command + " " + cpp_compression_source
    run(compile_command, print_output=True)

    for textfile_name in textfiles_names:
        textfile_path = textfiles_dir + textfile_name
        textfile_zip_path = textfile_path + ".myzip"

        plot_values = []
        plot_labels = []

        for algorithm in compression_algorithms:
            plot_labels += [algorithm]
        plot_labels += ['gzip']

        for algorithm in compression_algorithms:
            compression_command = run_base_command + ' %s %s compress' % (
                algorithm, textfile_path)
            decompression_command = run_base_command + ' %s %s decompress' % (
                algorithm, textfile_zip_path)
            run(compression_command, print_output=True)

            r = functools.partial(run,
                                  decompression_command,
                                  print_output=True)
            run_time = get_run_time(r, runs=num_of_runs)
            plot_values += [run_time]

        textfile_gzip_path = textfile_path + ".gz"
        gzip_compress_command = "gzip -k -f " + textfile_path
        gzip_decompress_command = "gzip -k -f -d " + textfile_gzip_path
        run(gzip_compress_command)
        r = functools.partial(run, gzip_decompress_command, print_output=True)
        run_time = get_run_time(r, runs=num_of_runs)
        plot_values += [run_time]

        print(plot_values)

        PlotUtils.bar_plot(plot_values=plot_values,
                           plot_labels=plot_labels,
                           colors=colors,
                           ylabel="time in seconds",
                           title="Decompression time of " + textfile_name,
                           save_filename='plots/decompress-time-' +
                           textfile_name)
Example #4
0
def plot_compression_size():
    compile_command = '%s %s' % (compile_base_command, cpp_compression_source)
    run(compile_command, print_output=True)

    for textfile_name in textfiles_names:
        textfile_path = textfiles_dir + textfile_name
        textfile_zip_path = textfile_path + ".myzip"

        plot_values = []
        plot_labels = []
        for algorithm in compression_algorithms:
            plot_labels += [algorithm]
        plot_labels += ['gzip']

        for algorithm in compression_algorithms:
            run_command = run_base_command + ' %s %s compress' % (
                algorithm, textfile_path)

            if os.path.exists(textfile_zip_path):
                os.remove(textfile_zip_path)

            run(run_command, print_output=True)
            compressed_size = os.path.getsize(textfile_zip_path)
            plot_values += [compressed_size]

        gzip_command = "gzip -k -f " + textfile_path
        run(gzip_command)
        textfile_gzip_path = textfile_path + ".gz"
        gzip_size = os.path.getsize(textfile_gzip_path)
        plot_values += [gzip_size]

        print(plot_values)

        PlotUtils.bar_plot(plot_values,
                           plot_labels=plot_labels,
                           colors=colors,
                           ylabel="size in bytes",
                           title="Compression size of " + textfile_name,
                           save_filename='plots/compress-size-' +
                           textfile_name)