BZIP2 compression extremely slow

Hi. I am working on migrating an Ant-based project to Gradle, and one sticking point is that the distTar task with compression = Compression.BZIP2 set is 5x slower than the equivalent Ant task.

Is this a known issue? Is there a good fix or workaround?

Edit: For a workaround, having Gradle make an uncompressed .tar and then bzipping with Ant speeds things up immensely:

distTar.compression = Compression.NONE
distTar.doLast {
    ant.bzip2(src: distTar.archivePath, destfile: "${distTar.archivePath}.bz2")
    delete distTar.archivePath // optional
}

No, this isn’t a known problem. I’ve reproduced it and opened GRADLE-3441.

What’s very strange about this is that we use the same libraries as Ant, so I wouldn’t expect that we would be any different.

Thanks for the report!

1 Like

A fix for this will be in 2.14 (2.13 is only accepting regression fixes).

1 Like