-
Couldn't load subscription status.
- Fork 16
Open
Description
Currently the Build Cache implementations load the build cache entries into memory as a ByteArray
Lines 70 to 74 in 6ff6573
val output = ByteArrayOutputStream() output.use { writer.writeTo(output) } storageService.store(cacheKey, output.toByteArray()) Lines 72 to 76 in 6ff6573
val output = ByteArrayOutputStream() output.use { writer.writeTo(output) } storageService.store(cacheKey, output.toByteArray())
I believe this will negatively impact performance (although I admit I haven't done any testing, so I could be wrong!).
It can be avoided by piping the streams. For example:
override fun store(key: BuildCacheKey, writer: BuildCacheEntryWriter) {
// ...
val incoming = PipedOutputStream()
writer.writeTo(incoming)
val contents = PipedInputStream(incoming)
storageService.store(cacheKey, contents, writer.size) // must manually pass the size down
}I'd be happy to contribute a PR.
Metadata
Metadata
Assignees
Labels
No labels