#870 Copying diff lines seems inefficient

Trunk
open
nobody
3
2005-06-28
2005-05-06
Kimmo Varis
No

We copy diff lines line per line, in
CMergeDoc::ListCopy() :

778: // copy the selected text over
779: for (int i=cd_dbegin; i <= limit; i++)
780: {
781: // text exists on left side, so just replace
782: strLine = _T("");
783: sbuf.GetFullLine(i, strLine);
784: dbuf.ReplaceFullLine(curView, i, strLine,
CE_ACTION_MERGE);
785: dbuf.FlushUndoGroup(curView);
786: dbuf.BeginUndoGroup(TRUE);
787: }
788: dbuf.FlushUndoGroup(curView);

Why do we need to flush/begin undogroup for every line?

After all we end up to
CMergeDoc::CDiffTextBuffer::ReplaceLine():

1723: if (GetLineLength(nLine)>0)
1724: DeleteText(pSource, nLine, 0, nLine,
GetLineLength(nLine), nAction);
1725: int endl,endc;
1726: if (! strText.IsEmpty())
1727: InsertText(pSource, nLine, 0, strText,
endl,endc, nAction);
1728: }

Seems a lot of work per line for me? Several line
length checks etc. Couldn't we copy multiple lines at a
time?

Discussion

  • elsapo
    elsapo
    2005-05-07

    Logged In: YES
    user_id=1195173

    I am not familiar with this code (at least not now, if I
    ever was).

     
  • Kimmo Varis
    Kimmo Varis
    2005-06-28

    Logged In: YES
    user_id=631874

    Lowering priority.

     
  • Kimmo Varis
    Kimmo Varis
    2005-06-28

    • labels: --> (Code) Cleanup
    • milestone: --> Trunk
    • priority: 5 --> 3