leonbloy / pngj

PNGJ : pure Java library for high performance PNG encoding
http://hjg.com.ar/pngj/
273 stars 52 forks source link

Slow write speeds #37

Closed jwcharp closed 5 years ago

jwcharp commented 9 years ago

I am only getting around 3-5 MB/s writes on my SSD. Is there anyway to speed this up?

I am trying to go down the path of writing my own PNG stream writer, but cant seem to get the chunks to write correctly, I am only able to see the first chunk, i write.

However perhaps there is a method or way to speed up PNGJ that I am not aware of. Any hints?

leonbloy commented 5 years ago

There are two factors that influence the write speed: ZLIB compression level (see PngWrite.setCompLevel() ) and filter strategy setFilterType()

If you set the compression level low (extreme: 0 = no compression) and select one of the standard filters (or the FILTER_DEFAULT strategy) you optimize the speed, at least with respect with CPU/ram encoding. Bear in mind that when the compression gets worse, the image gets bigger, so the disk writing speed could be the bottleneck.