On 2021-01-29 Brett Okken wrote: > Here are some small improvements when creating new BlockInputStream > instances. This reduces the size of the byte[] for the block header to > the actual size
I committed this part. Thanks! > and replaces use of ByteArrayInputStream, which has synchronized > methods, with a ByteBuffer, which provides the same functionality > without synchronization. Hmm, it sounds good but I don't like that decodeVLI needs to be duplicated. The performance of header decoding in BlockInputStream is fairly unimportant; the performance bottle necks are elsewhere. Keeping the code tidy matters more. Obviously one could wrap ByteBuffer into an InputStream or one could change IndexHash.java and IndexDecoder.java to work with something else. Those Index* classes might be reading from an InputStream that has high read()-call overhead for reasons other than locking (although in such cases the application could then be using BufferedInputStream). Unless you have a practical situation in mind where these optimizations make a measurable difference, it's best to not make them more complex than they are. By the way, I committed module-info.java support as multi-release JAR, so multi-release can be used for other things too. -- Lasse Collin | IRC: Larhzu @ IRCnet & Freenode