Things like this
[pascal]while (IText <Length> #32) do
begin
Part := Part+Text[IText]; [/pascal]
kill performance on the spot. Brutally.
EACH time you add a char to a string, a call to realloc its memory is performed. So you can imagine how "fast" will this code execute.
Ideally, you should make two passes. The first one determines subsstring lengths and positions, the second pass allocates memory by calling SetLength for destination strings (once!) and copies the characters.
As a person who is greatly annoed by the lagre save/load times, I pay a big attention to such matter. There are fields that do not worth optimization. This is *not* one of these.
P.S. My game, even on the 80386, performed quicksave and quickload as fast as you can tap a key - unlike, for example, doom/doom2. So I know what I am talking about.
Bookmarks