One trick you could try is: in find_longest_match, if you already have a match, check if the byte at match_maxlen matches before doing the linear compare off all bytes up to it.<p>If that one byte does not match, the entire match has no chance of being longer than the current best (in this simple case).