Skip to content

Commit

Permalink
Regression: fix compilation performance on Windows by caching isDirec…
Browse files Browse the repository at this point in the history
…tory calls

Fixes #19924
backport to start-3.4.1
  • Loading branch information
OlegYch committed Apr 15, 2024
1 parent 54d67e0 commit 76542f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/io/PlainFile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import java.nio.file.{InvalidPathException, Paths}

/** ''Note: This library is considered experimental and should not be used unless you know what you are doing.'' */
class PlainDirectory(givenPath: Directory) extends PlainFile(givenPath) {
override def isDirectory: Boolean = true
override val isDirectory: Boolean = true
override def iterator(): Iterator[PlainFile] = givenPath.list.filter(_.exists).map(new PlainFile(_))
override def delete(): Unit = givenPath.deleteRecursively()
}
Expand Down Expand Up @@ -78,7 +78,7 @@ class PlainFile(val givenPath: Path) extends AbstractFile {
}

/** Is this abstract file a directory? */
def isDirectory: Boolean = givenPath.isDirectory
val isDirectory: Boolean = givenPath.isDirectory

/** Returns the time that this abstract file was last modified. */
def lastModified: Long = givenPath.lastModified.toMillis
Expand Down

0 comments on commit 76542f8

Please sign in to comment.