cbeust / kobalt

A Kotlin-based build system for the JVM.
Apache License 2.0
433 stars 60 forks source link

Reduce time spent in JAR/ZIP assembly. #400

Closed rhencke closed 7 years ago

rhencke commented 7 years ago

Locally, this reduces a run of kobaltw assemble --noIncremental on the Kobalt codebase itself from 47 seconds to 25 seconds.

When JarInputStream.nextEntry is invoked, the stream sets its position and length so that it can directly be used to read the underlying content associated with the entry. This avoids the need to call JarFile(localFile).getInputStream(entry) and the cost associated with it.

addEntry has a slight change of semantics due to this change - it is now the caller's responsibility to close the associated input stream. The two existing calls to the method were adjusted accordingly.