<commit_before>import time
from parinfer import indent_mode, paren_mode

def timeProcess(string, options):
  numlines = len(string.splitlines())
  print "Testing file with", numlines, "lines"

  t = time.clock()
  indent_mode(string, options)
  dt = time.clock() - t
  print "Indent Mode:", dt, "s"

  t = time.clock()
  paren_mode(string, options)
  dt = time.clock() - t
  print "Paren Mode:", dt, "s"

with open('tests/really_long_file', 'r') as f:
    text = f.read()

timeProcess(text, {})<commit_msg>add profiling to perf.py<commit_after>import cProfile
import time
from parinfer import indent_mode, paren_mode

def timeProcess(string, options):
  numlines = len(string.splitlines())
  print "Testing file with", numlines, "lines"

  t = time.clock()
  indent_mode(string, options)
  dt = time.clock() - t
  print "Indent Mode:", dt, "s"

  t = time.clock()
  paren_mode(string, options)
  dt = time.clock() - t
  print "Paren Mode:", dt, "s"

  cProfile.runctx("indent_mode(string, options)", globals(), locals())
  cProfile.runctx("paren_mode(string, options)", globals(), locals())

with open('tests/really_long_file', 'r') as f:
    text = f.read()

timeProcess(text, {})
{'fraction_non_alphanumeric': 0.15325994919559696, 'fraction_numerical': 0.0, 'mean_word_length': 4.5233644859813085, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6353060', 'n_tokens_mistral': 416, 'n_tokens_neox': 408, 'n_words': 113}