From ac92c2af65a064da2a6ac94d30071ba6aa8ac04d Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Sun, 19 Mar 2017 20:54:21 -0400 Subject: performance: avoid io call when building classpath string --- stage1/ClassPath.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'stage1/ClassPath.scala') diff --git a/stage1/ClassPath.scala b/stage1/ClassPath.scala index d8568c2..539efc7 100644 --- a/stage1/ClassPath.scala +++ b/stage1/ClassPath.scala @@ -22,6 +22,9 @@ case class ClassPath(files: Seq[File] = Seq()){ def ++(other: ClassPath) = ClassPath(files ++ other.files) def string = strings.mkString( File.pathSeparator ) def strings = files.map{ - f => f.string ++ ( if(f.isDirectory) "/" else "" ) + f => f.string + ( + // using file extension instead of isDirectory for performance reasons + if( f.getName.endsWith(".jar") /* !f.isDirectory */ ) "" else "/" + ) }.sorted } -- cgit v1.2.3