<commit_before># encoding: UTF-8

require 'rubygems'
require 'benchmark'
require 'mysql'
require 'mysql2_ext'

number_of = 1
database = 'nbb_1_production'
sql = "SELECT * FROM account_transactions"

Benchmark.bmbm do |x|
  mysql = Mysql.new("localhost", "root")
  mysql.query "USE #{database}"
  x.report do
    puts "Mysql"
    number_of.times do
      mysql_result = mysql.query sql
      # number = 0
      mysql_result.each_hash do |res|
        # number += 1
        # puts res.inspect
      end
      # puts "Processed #{number} results"
    end
  end

  mysql2 = Mysql2::Client.new
  mysql2.query "USE #{database}"
  x.report do
    puts "Mysql2"
    number_of.times do
      mysql2_result = mysql2.query sql
      # number = 0
      mysql2_result.each(:symbolize_keys => true) do |res|
        # number += 1
        # puts res.inspect
      end
      # puts "Processed #{number} results"
    end
  end
end<commit_msg>testing benchmark script<commit_after># encoding: UTF-8

require 'rubygems'
require 'memprof'
# require 'benchmark'
# require 'mysql'
require 'mysql2_ext'

number_of = 1
database = 'nbb_1_production'
sql = "SELECT * FROM account_transactions"

# Benchmark.bmbm do |x|
  Memprof.start
  # mysql = Mysql.new("localhost", "root")
  # mysql.query "USE #{database}"
  # x.report do
    # puts "Mysql"
    # number_of.times do
      # mysql_result = mysql.query sql
      # number = 0
      # mysql_result.each_hash do |res|
        # number += 1
        # puts res.inspect
      # end
  # Memprof.stats
  # Memprof.stop
      # puts "Processed #{number} results"
    # end
  # end

  mysql2 = Mysql2::Client.new
  mysql2.query "USE #{database}"
  # x.report do
  #   puts "Mysql2"
  #   number_of.times do
      mysql2_result = mysql2.query sql
  #     # number = 0
      mysql2_result.each(:symbolize_keys => true) do |res|
  #       # number += 1
  #       # puts res.inspect
      end
  #     # puts "Processed #{number} results"
  #   end
  # end
  Memprof.stats
  Memprof.stop
# end
{'fraction_non_alphanumeric': 0.114598903836572, 'fraction_numerical': 0.014947683109118086, 'mean_word_length': 2.5602836879432624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '464001', 'n_tokens_mistral': 720, 'n_tokens_neox': 702, 'n_words': 178}