Speed Problems w/9.0

Giganews Newsgroups
Subject: Speed Problems w/9.0
Posted by:  glenn (gbarker…@comcast.net)
Date: Sun, 14 Dec 2003

Hello All,

I have an application that has many brief  "conversations" using Indy's
TCPClient/Servers.  A "conversation" includes: a connect, a request for
data, the reply with data, and disconnect.  I have been using Indy ver 8.023
with good performance, however, 8.023 does not have the option of limiting a
connect() attempt -and Indy 9.x does (if a server is not there, 8.x will
hang retrying for ~30 secs.).  When I installed and use Indy 9.x though, my
performance dropped off significantly.  I ran a little test program to time
a conversation and found the test case conversation took ~20 mSec for v8.x
and ~150 mSec for 9.x. Does this seem right?  Or do I likely have some
"leftovers" of 8.x causing havoc, or maybe something else?  Are there
configuration/project options which will get performance similar to 8.x?

Below is the test code I used to time the two packages.  Any suggestions to
speed up 9.Xwould be greatly appreciated.

glenn

ClientSide:
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{

  // varied timer interval from 1 sec down until it won't get any faster
  // ~20 mSec for 8.x      ~150 mSec for 9.x!!!

  static double start = 0, end = 0, difference = 0, max = 0;
  struct timeb t1;
  ostringstream out;

  out.setf( std::ios::fixed, std::ios::floatfield );
  out.setf( std::ios::showpoint );
  out << std::setprecision( 3 );

  try
  {
    ::ftime( &t1 );
    end =  t1.time + ( t1.millitm / 1000.0 );
    out << ( end - start );
    Panel1->Caption = out.str().c_str();
    start = end;

    //  for Indy 8.X
    // IdTCPClient1->Connect();
    //  AnsiString S = IdTCPClient1->ReadLn( "", 5000 );

    // for Indy 9.X
    IdTCPClient1->Connect( 5000 );
    AnsiString S = IdTCPClient1->ReadLn("", 5000, -1);

    Edit2->Text = S;
    IdTCPClient1->Disconnect();
  }
  catch( EIdException &E )
  {
    ShowMessage( "Indy Error" );
  }
}
file://---------------------------------------------------------------------
------

ServerSide:
void __fastcall TForm1::IdTCPServer1Execute(TIdPeerThread *AThread)
{
  AThread->Connection->WriteLn( Edit2->Text.c_str() );
}
file://---------------------------------------------------------------------
------

Replies