Cliff's file contains a UTF-8 byte order mark, about 1 megabyte of NULs, then another megabyte of lines of log data. I don't want to put too much effort or add too much code complexity to support this file but it would be reasonable to look at small modifications so that users that accidentally open a binary file or deliberately open a classic megabyte of XML on one line file are not punished too severely.
The example file takes about half a second to layout on my machine and this information is normally cached. Most of the time is taken up in measuring the widths of a million [NUL] symbols. A small cache remembering the widths of all the control character symbols is 5 times faster. That looks like a big win but on an arbitrary binary file (SciTE.EXE 1.66) it is only 20% faster. Varying the lifetime of this cache between every layout and immortal is not significant. A profile shows looping through a million character line retrieving characters or styles is fairly expensive although this is somewhere where profilers tend to overreport compared to system calls. The drawing loops only go into the more costly processing for text segments that may be visible. It can save a little time by exiting the loop after moving past the right hand side of the window. The indicator drawing code is quite expensive and occurs even for lines that have no indicators. This can be detected in LayoutLine by oring all the style bytes together and only performing the indicator drawing loop for lines that contain each particular indicator. On a one megabyte single line HTML file this speeds up paint by a factor of 15 so looks like a reasonable optimization. Neil _______________________________________________ Scintilla-interest mailing list [email protected] http://mailman.lyra.org/mailman/listinfo/scintilla-interest
