<commit_before>require 'spec_helper'
require 'benchmark'

describe Text::Table, 'performance' do
  it 'is linear relative to row count' do
    base = time_to_render_num_of_rows  300
    time = time_to_render_num_of_rows 3000

    time.should_not > base * 15
  end

  def time_to_render_num_of_rows(num)
    GC.start

    Benchmark.measure {
      Text::Table.new(:rows => Array.new(num)).to_s
    }.total
  end
end
<commit_msg>Ensure base time is not zero.<commit_after>require 'spec_helper'
require 'benchmark'

describe Text::Table, 'performance' do
  it 'is linear relative to row count' do
    base = time_to_render_num_of_rows  1_000
    time = time_to_render_num_of_rows 10_000

    time.should_not > base * 15
  end

  def time_to_render_num_of_rows(num)
    GC.start

    Benchmark.measure {
      Text::Table.new(:rows => Array.new(num)).to_s
    }.total
  end
end

{'fraction_non_alphanumeric': 0.08810068649885583, 'fraction_numerical': 0.02288329519450801, 'mean_word_length': 3.6296296296296298, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1541728', 'n_tokens_mistral': 337, 'n_tokens_neox': 309, 'n_words': 75}