On Tue, Feb 16, 2021 at 12:48 PM Lasse Collin <lasse.col...@tukaani.org> wrote: > > I quickly tried these with "XZEncDemo 2". I used the preset 2 because > that uses LZMAEncoderFast instead of LZMAEncoderNormal where the > negative lengths result in a crash.
I updated the mismatch method to check for negative lengths upfront: return length > 0 ? (int) MISMATCH.invokeExact(bytes, aFromIndex, bFromIndex, length) : 0; I must not have sent that out. > The performance was about the same > or worse than the original code. I don't know why. I didn't spend much > time on this and it's possible that I messed up something. I have only been testing at the default preset (6). I should add tests for the one of the "fast" presets as well. > One thing that may be worth checking out is how in HC4.java (and > BT4.java too) the patch doesn't try to quickly skip too short matches > like the original code does. I suppose the first set of patches should > be such that they only replace the byte-by-byte loops with a function > call to make comparison as fair as possible. In the BT4, (what is being tested), it does not actually seem to benefit from the "too short" matches, at least for the content I was testing. This might be different for HC4. > These patches won't get into XZ for Java 1.9 but might be in a later > version if I see them being/becoming good. The only remaining patch > that might get into 1.9 is LZDecoder.repeat improvements. Sounds good. > When you post a patch or other code, please make sure that word-wrapping > is disabled in the email client or use attachments. Thanks! I will move to attachments. I do not see how to stick with plain text and keep gmail from wrapping. Brett