Re: [PATCH] optimization opportunity regarding misuse of BufferedInputStream

2020-08-28 Thread Florian Weimer
* Сергей Цыпанов: > Hi, > >> Isn't this InputStream::readAllBytes? > > thanks for pointing this out! Indeed, InputStream::readAllBytes() allows to > save even more memory: > > Mode Cnt Score Error Units > read

Re: [PATCH] optimization opportunity regarding misuse of BufferedInputStream

2020-08-28 Thread Сергей Цыпанов
Hi, > Isn't this InputStream::readAllBytes? thanks for pointing this out! Indeed, InputStream::readAllBytes() allows to save even more memory: Mode Cnt Score Error Units read avgt 50 227.054 ± 1.354

Re: [PATCH] optimization opportunity regarding misuse of BufferedInputStream

2020-08-28 Thread Florian Weimer
* Сергей Цыпанов: > @@ -105,12 +105,8 @@ > private byte[] getBytes(InputStream is) > throws IOException > { > -byte[] buffer = new byte[8192]; > ByteArrayOutputStream baos = new ByteArrayOutputStream(2048); > -int n; > -while ((n =

[PATCH] optimization opportunity regarding misuse of BufferedInputStream

2020-08-27 Thread Сергей Цыпанов
Hi, while looking into java.util.jar.JarInputStream I've found a misuse of BufferedInputStream in checkManifest() method where InputStream is wrapped into BIS and later read from with separately created byte[] buffer. At runtime this means the data is copied from original IS into BIS and from