More efficient computation of segment edits