<commit_before>package org.scalameter



import collection._
import utils.Tree



abstract class PerformanceTest extends PerformanceTest.Initialization {

  def main(args: Array[String]) {
    val ctx = Main.Configuration.fromCommandLineArgs(args).context
    val ok = dyn.initialContext.withValue(ctx) {
      executeTests()
    }

    if (!ok) sys.exit(1)
  }

}


object PerformanceTest {

  trait Initialization extends DSL with DelayedInit {

    import DSL._

    def executor: org.scalameter.Executor

    def reporter: org.scalameter.Reporter

    def persistor: Persistor

    type SameType

    def executeTests(): Boolean = {
      val datestart = new java.util.Date
      DSL.setupzipper.value = Tree.Zipper.root[Setup[_]]
      testbody.value.apply()
      val rawsetuptree = DSL.setupzipper.value.result
      val setuptree = rawsetuptree.filter(setupFilter)
      val resulttree = executor.run(setuptree.asInstanceOf[Tree[Setup[SameType]]], reporter, persistor)
      val dateend = new java.util.Date

      val datedtree = resulttree.copy(context = resulttree.context + (Key.reports.startDate -> datestart) + (Key.reports.endDate -> dateend))
      reporter.report(datedtree, persistor)
    }

    def delayedInit(body: =>Unit) {
      // Save the *current* value of testbody.value, so that next line closes
      // over this value and not testbody itself.
      val current = testbody.value
      testbody.value = () => { current(); body }
      testbodySet = true
    }

  }

  private def setupFilter(setup: Setup[_]): Boolean = {
    val sf = initialContext.goe(Key.scopeFilter, "")
    val fullname = setup.context.scope + "." + setup.context.curve
    val regex = sf.r
    regex.findFirstIn(fullname) != None
  }
<commit_msg>Add defaultConfig<commit_after>package org.scalameter



import collection._
import utils.Tree



abstract class PerformanceTest extends PerformanceTest.Initialization {

  def main(args: Array[String]) {
    val ctx = Main.Configuration.fromCommandLineArgs(args).context
    val ok = dyn.initialContext.withValue(ctx) {
      executeTests()
    }

    if (!ok) sys.exit(1)
  }

}


object PerformanceTest {

  trait Initialization extends DSL with DelayedInit {

    import DSL._

    def executor: org.scalameter.Executor

    def reporter: org.scalameter.Reporter

    def persistor: Persistor

    def defaultConfig: Seq[(String, Any)] = Seq()

    type SameType

    def executeTests(): Boolean = {
      val datestart = new java.util.Date
      DSL.setupzipper.value = defaultConfig.foldLeft(Tree.Zipper.root[Setup[_]])(_.addContext(_))
      testbody.value.apply()
      val rawsetuptree = DSL.setupzipper.value.result
      val setuptree = rawsetuptree.filter(setupFilter)
      val resulttree = executor.run(setuptree.asInstanceOf[Tree[Setup[SameType]]], reporter, persistor)
      val dateend = new java.util.Date

      val datedtree = resulttree.copy(context = resulttree.context + (Key.reports.startDate -> datestart) + (Key.reports.endDate -> dateend))
      reporter.report(datedtree, persistor)
    }

    def delayedInit(body: =>Unit) {
      // Save the *current* value of testbody.value, so that next line closes
      // over this value and not testbody itself.
      val current = testbody.value
      testbody.value = () => { current(); body }
      testbodySet = true
    }

  }

  private def setupFilter(setup: Setup[_]): Boolean = {
    val sf = initialContext.goe(Key.scopeFilter, "")
    val fullname = setup.context.scope + "." + setup.context.curve
    val regex = sf.r
    regex.findFirstIn(fullname) != None
  }

{'fraction_non_alphanumeric': 0.10606904231625836, 'fraction_numerical': 0.0005567928730512249, 'mean_word_length': 3.173054587688734, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2136152', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1057, 'n_words': 258}