in reply to Optimizing Algorithm::Diff

I would guess that the lag is the difference between the best case scenario (1-1 match across both texts) and the worst case scenario (texts have repeating sequences that aren't exactly the same). Do you get the same processing time every time for the same two sections of text? If so, you'll just have to live with the lag - there really isn't a good way to make every Diff computation run quickly and accurately at the same time.