>I have been happily enjoying the simplicity of using ReceiveStr. However I
> now have a requirement to send much larger amounts of data. I have
> profiled
> my app and have concluded that the largest bottleneck ( > 50%) is
> ReceiveStr.
>
> My app now needs to send a large number of records. Currently, I'm
> converting each record to a string and calling SendStr and the client is
> using ReceiveStr.
>
> Is the speed improvement potential worth the added complexity to covert my
> app from using SendStr and ReceiveStr to Send and Receive?
If you look at SendStr source code, you'll see that it's implementation is
quite trivial:
function TCustomWSocket.SendStr(const Str : String) : Integer;
begin
if Length(Str) > 0 then
Result := Send(@Str[1], Length(Str))
else
Result := 0;
end;
Removing SendStr will not drastically change performance.
Removing the conversion to string will enhance performance, or if you keep
strings (which is a good idea in my opinion), pay attention to avoid copying
data from here to there. You may also write more complex code which would
avoir using strings which are inherently slow because they are dynamic
objects. You may thing of allocation a buffer just one time and keep that
buffer, using Send to send part of the buffer.
Using ReceiveStr is quite slow because it involve copying data one more
time. You may can Receive to receive data directly in the variable where you
will process it.
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be