Hi All,
Last Friday, while walking through db_send_message_lines looking for
stuff
that made it slow, I found something interesting:
To fill the buffer, every character from the messageblock is appended
to the
buffer: sprintf(buffer, "%s%c", buffer, *nextpos)
This operation can be really slow, especially when the string in the
buffer
is really long. The position to put the character *nextpos in, has to
be found
by finding the length of the string in buffer.
I've changed this appending of characters to:
buffer[buffer_pos++] = *nextpos
buffer_pos is used to "remember" the length of the string in the
buffer. Of
course, buffer_pos is initially 0, and is reset to 0 every time the
buffer
is cleared.
Earlier today I've put this code in CVS for the 2.0 branch
Ilja
--
IC&S
Koningsweg 4
3582 GE UTRECHT
Last Friday, while walking through db_send_message_lines looking for
stuff
that made it slow, I found something interesting:
To fill the buffer, every character from the messageblock is appended
to the
buffer: sprintf(buffer, "%s%c", buffer, *nextpos)
This operation can be really slow, especially when the string in the
buffer
is really long. The position to put the character *nextpos in, has to
be found
by finding the length of the string in buffer.
I've changed this appending of characters to:
buffer[buffer_pos++] = *nextpos
buffer_pos is used to "remember" the length of the string in the
buffer. Of
course, buffer_pos is initially 0, and is reset to 0 every time the
buffer
is cleared.
Earlier today I've put this code in CVS for the 2.0 branch
Ilja
--
IC&S
Koningsweg 4
3582 GE UTRECHT