Permalink
Browse files

Profiling settings plus small performance improvements

  • Loading branch information...
szeiger committed Aug 24, 2015
1 parent ed954e5 commit b48115a6b8262e58d2385d0d36c628eeee3cc9b1
View
@@ -253,6 +253,8 @@ object SlickBuild extends Build {
(Dependencies.logback +: Dependencies.testDBs).map(_ % "codegen"),
parallelExecution in Test := false,
fork in run := true,
//connectInput in run := true,
//javaOptions in run += "-agentpath:/Applications/YourKit_Java_Profiler_2015_build_15072.app/Contents/Resources/bin/mac/libyjpagent.jnilib",
javaOptions in run += "-Dslick.ansiDump=true",
//javaOptions in run += "-verbose:gc",
compile in Test ~= { a =>
@@ -35,7 +35,15 @@ object CompilerBenchmark {
val (asts, t2) = time("Creating ASTs", COUNT_TONODE)(queries.map(_.toNode))
phases.foreach(p => phaseNanos += (p.name -> new Array[Long](1)))
//asts.zipWithIndex.foreach { case (n, i) => println(i); compiler.run(n) }
/*if(i == RUNS-1) {
println("Attach profiler and press Return")
Console.readLine()
}*/
val (compiled, t3) = time("Compiling", COUNT_COMPILE)(asts.map(compiler.run(_)))
/*if(i == RUNS-1) {
println("Detach profiler and press Return")
Console.readLine()
}*/
println(String.format("Creating: %1$7.3f ms, toNode: %2$7.3f ms, compiling: %3$7.3f ms", t1.asInstanceOf[AnyRef], t2.asInstanceOf[AnyRef], t3.asInstanceOf[AnyRef]))
}
@@ -30,7 +30,7 @@ trait JdbcMappingCompilerComponent { driver: JdbcDriver =>
def createColumnConverter(n: Node, idx: Int, column: Option[FieldSymbol]): ResultConverter[JdbcResultConverterDomain, _] = {
val JdbcType(ti, option) = n.nodeType.structural
if(option) createOptionResultConverter(ti, idx)
else createBaseResultConverter(ti, column.fold(n.toString)(_.name), idx)
else createBaseResultConverter(ti, column.fold("<computed>")(_.name), idx)
}
override def createGetOrElseResultConverter[T](rc: ResultConverter[JdbcResultConverterDomain, Option[T]], default: () => T) = rc match {
@@ -23,7 +23,7 @@ trait ResultConverterCompiler[Domain <: ResultConverterDomain] {
case OptionApply(Select(_, ElementSymbol(idx))) => createColumnConverter(n, idx, None)
case ProductNode(ch) =>
if(ch.isEmpty) new UnitResultConverter
else new ProductResultConverter(ch.map(n => compile(n))(collection.breakOut): _*)
else new ProductResultConverter(ch.map(n => compile(n)): _*)
case GetOrElse(ch, default) =>
createGetOrElseResultConverter(compile(ch).asInstanceOf[ResultConverter[Domain, Option[Any]]], default)
case TypeMapping(ch, mapper, _) =>

0 comments on commit b48115a

Please sign in to comment.