title: Delphi TIdHTTP POST is very slow vs GET
body: <p>Delphi 2009</p>
  
  <p>I recently switched from multiple GET requests to a single POST which I thought would be more efficient but it has turned out to be much slower.  It went from 1-2 seconds to 8-10 seconds and I can't figure out why.</p>
  
  <p>example</p>
  
  <pre><code>unit Unit4;
  
  interface
  
  uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
    IdHTTP;
  
  type
    TForm4 = class(TForm)
      d: TIdHTTP;
      Memo1: TMemo;
      Button1: TButton;
      procedure Button1Click(Sender: TObject);
    private
      { Private declarations }
    public
      { Public declarations }
    end;
  
  var
    Form4: TForm4;
  
  implementation
  
  {$R *.dfm}
  
  procedure TForm4.Button1Click(Sender: TObject);
  var m: tmemorystream;
      data: tstringlist;
      i: integer;
  begin
    memo1.Clear;
  
    m:=tmemorystream.Create;
    data:=tstringlist.Create;
    data.Add(format('test1');
    data.Add(format('test2');
  
    d.Post('http://www.someurl.com/test.php', data, m);
    m.Position:=0;
    data.LoadFromStream(m);
    memo1.Lines.Add('Received:');
  
    for i := 0 to data.count - 1 do
      memo1.Lines.Add(data[i]);
  
    m.Free;
    data.Free;
  end;
  
  end.
  </code></pre>
  
  <p>and on the server</p>
  
  <pre><code>&lt;?php
  echo "1\n";
  ?&gt;
  </code></pre>