<commit_before>module Benchmark

  module BigO
    class Chart

      TYPES = [:logn, :n, :nlogn, :n_sq]

      def initialize(report_data, sizes)
        @data = report_data.freeze
        @sizes = sizes.freeze

        @sample_size = @sizes.first

        # can't take log of 1,
        # so it can't be used as the sample
        if @sample_size == 1
          @sample_size = @sizes[1]
        end
      end

      def generate config={}

        charts = [ { name: 'Growth Chart',
                    data: @data,
                    opts: opts_for(@data) } ]

        if config[:compare]
          for entry_data in @data
            charts << { name: entry_data[:name],
                        data: comparison_for(entry_data),
                        opts: opts_for([entry_data]) }
          end
        end

        charts
      end

      def opts_for data
        data = [data] unless Array === data

        axis_type = 'linear'

        min = data.collect{|d| d[:data].values.min }.min
        max = data.collect{|d| d[:data].values.max }.max

        orange = "#f0662d"
        purple = "#8062a6"
        light_green = "#7bc545"
        med_blue = "#0883b2"
        yellow = "#ffaa00"

        {
          discrete: true,
          width: "800px",
          height: "500px",
          min: (min * 0.8).floor,
          max: (max * 1.2).ceil,
          library: {
            colors: [orange, purple, light_green, med_blue, yellow],
            xAxis: {type: axis_type, title: {text: "Size"}},
            yAxis: {type: axis_type, title: {text: "Microseconds per Iteration"}}<commit_msg>axis variable is not necessary<commit_after>module Benchmark

  module BigO
    class Chart

      TYPES = [:logn, :n, :nlogn, :n_sq]

      def initialize(report_data, sizes)
        @data = report_data.freeze
        @sizes = sizes.freeze

        @sample_size = @sizes.first

        # can't take log of 1,
        # so it can't be used as the sample
        if @sample_size == 1
          @sample_size = @sizes[1]
        end
      end

      def generate config={}

        charts = [ { name: 'Growth Chart',
                    data: @data,
                    opts: opts_for(@data) } ]

        if config[:compare]
          for entry_data in @data
            charts << { name: entry_data[:name],
                        data: comparison_for(entry_data),
                        opts: opts_for([entry_data]) }
          end
        end

        charts
      end

      def opts_for data
        data = [data] unless Array === data

        min = data.collect{|d| d[:data].values.min }.min
        max = data.collect{|d| d[:data].values.max }.max

        orange = "#f0662d"
        purple = "#8062a6"
        light_green = "#7bc545"
        med_blue = "#0883b2"
        yellow = "#ffaa00"

        {
          discrete: true,
          width: "800px",
          height: "500px",
          min: (min * 0.8).floor,
          max: (max * 1.2).ceil,
          library: {
            colors: [orange, purple, light_green, med_blue, yellow],
            xAxis: {type: 'linear', title: {text: "Size"}},
            yAxis: {type: 'linear', title: {text: "Microseconds per Iteration"}}
{'fraction_non_alphanumeric': 0.12032673578385171, 'fraction_numerical': 0.020735155513666354, 'mean_word_length': 1.5698143664245359, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '92666', 'n_tokens_mistral': 1043, 'n_tokens_neox': 961, 'n_words': 259}