In Synedit.pas the Ceil function is used in four
different places e.g. in TCustomSynEdit.ExpandAtWideGlyphs:
CountOfAvgGlyphs := Ceil(fTextDrawer.TextWidth(S[i])/
fCharWidth);
This function is very slow and coded suboptimally in
Delphi.
Patch:
Introduce a new function:
function CeilOfIntDiv(Dividend: Cardinal; Divisor:
Word): Word;
Var
Remainder: Word;
begin
DivMod(Dividend, Divisor, Result, Remainder);
if Remainder > 0 then
Inc(Result);
end;
and replace the calls to Ceil with calls to the above
function. The example above becomes:
CountOfAvgGlyphs :=
CeilOfIntDiv(fTextDrawer.TextWidth(S[i]), fCharWidth);