diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-19 20:52:29 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-27 23:54:16 -0400 |
commit | f5fe60ada0a550907a378592ee07291ee157f275 (patch) | |
tree | 34e87ed0fb42885caabeea72ab11439885aa62fc /stage1 | |
parent | e5940451943d360193af8fb52e65c3eadd980f87 (diff) | |
download | cbt-f5fe60ada0a550907a378592ee07291ee157f275.tar.gz cbt-f5fe60ada0a550907a378592ee07291ee157f275.tar.bz2 cbt-f5fe60ada0a550907a378592ee07291ee157f275.zip |
performance: cache moduleKey and make it’s string concat quicker
Diffstat (limited to 'stage1')
-rw-r--r-- | stage1/resolver.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/stage1/resolver.scala b/stage1/resolver.scala index 7866fcb..5090af7 100644 --- a/stage1/resolver.scala +++ b/stage1/resolver.scala @@ -158,13 +158,13 @@ case class BinaryDependency( paths: Seq[File], dependencies: Seq[Dependency] )(i def exportedClasspath = ClassPath(paths) override def lastModified = paths.map(_.lastModifiedRecursive).max // FIXME: cache this def targetClasspath = exportedClasspath - def moduleKey = this.getClass.getName ++ "(" ++ paths.mkString(", ") ++ ")" + lazy val moduleKey = this.getClass.getName + "(" + paths.mkString(", ") + ")" // PERFORMANCE HOTSPOT } /** Allows to easily assemble a bunch of dependencies */ case class Dependencies( dependencies: Seq[Dependency] )(implicit val logger: Logger, val transientCache: java.util.Map[AnyRef,AnyRef], val classLoaderCache: ClassLoaderCache) extends DependencyImplementation{ override def lastModified = dependencies.map(_.lastModified).maxOption.getOrElse(0) - def moduleKey = this.getClass.getName ++ "(" ++ dependencies.map(_.moduleKey).mkString(", ") ++ ")" + lazy val moduleKey = this.getClass.getName + "(" + dependencies.map(_.moduleKey).mkString(", ") + ")" // PERFORMANCE HOTSPOT def targetClasspath = ClassPath() def exportedClasspath = ClassPath() override def show: String = this.getClass.getSimpleName + "( " + dependencies.map(_.show).mkString(", ") + " )" @@ -172,7 +172,7 @@ case class Dependencies( dependencies: Seq[Dependency] )(implicit val logger: Lo case class PostBuildDependency(target: File, _dependencies: Seq[DependencyImplementation])(implicit val logger: Logger, val transientCache: java.util.Map[AnyRef,AnyRef], val classLoaderCache: ClassLoaderCache) extends DependencyImplementation{ override final lazy val lastModified = (target++".last-success").lastModified - def moduleKey = target.string + lazy val moduleKey = target.string override def show = s"PostBuildDependency($target)" override def targetClasspath = exportedClasspath override def exportedClasspath = ClassPath( Seq(target) ) @@ -234,7 +234,7 @@ case class BoundMavenDependency( )( implicit val logger: Logger, val transientCache: java.util.Map[AnyRef,AnyRef], val classLoaderCache: ClassLoaderCache ) extends ArtifactInfo with DependencyImplementation{ - def moduleKey = this.getClass.getName ++ "(" ++ mavenDependency.serialize ++ ")" + lazy val moduleKey = this.getClass.getName + "(" + mavenDependency.serialize + ")" // PERFORMANCE HOTSPOT override def hashCode = mavenDependency.hashCode override def equals(other: Any) = other match{ case o: BoundMavenDependency => o.mavenDependency == mavenDependency && o.repositories == repositories |