Why looping in Delphi faster than C#?

Posted by isa on Stack Overflow See other posts from Stack Overflow or by isa
Published on 2010-04-18T15:25:29Z Indexed on 2010/04/18 15:33 UTC
Read the original article Hit count: 365

Filed under:
|

Delphi:


procedure TForm1.Button1Click(Sender: TObject);
var I,Tick:Integer;
begin
  Tick := GetTickCount();
  for I := 0 to 1000000000 do
    begin
    end;
  Button1.Caption := IntToStr(GetTickCount()-Tick)+' ms';
end;

C#:


private void button1_Click(object sender, EventArgs e)
        {
            int tick = System.Environment.TickCount;
            for (int i = 0; i < 1000000000; ++i)
            {
            }
            tick = System.Environment.TickCount - tick;
            button1.Text = tick.ToString()+" ms"; 
        }

Delphi gives around 515 ms

C# gives around 3775 ms

© Stack Overflow or respective owner

Related posts about delphi

Related posts about c#