• Log in or sign up for an account here: https://www.sythe.org/login

Benchmark test - VB6/VC6/Delphi6/Java

Govind

The One Musketeer

Highly Respected
Mudkips
Retired Administrator
Joined
Apr 22, 2005
Sythe Gold
23
Messages
7,825
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
I have posted inaccurate benchmarks in the past. This here is a valid one.VC++6, VB6, and Delphi6 are running all program with equivalent algorithms to populate a 1000 element array with random elements 1000 times. (Byte and char types are equivalent in terms of size).

Here is the code I used for the Visual C++ 6 Benchmark:

Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ctime>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
    char data[1000];
    DWORD dwStart = GetTickCount();
    for(int i = 0; i < 1000; i++)
    {
        for(int j = 0; j < 1000; j++)
        {
            data[j] = (char)rand()%100;
        }
    } 
    DWORD dwEnd = GetTickCount();
    cout << "Took " << (dwEnd)-(dwStart) << " milliseconds to complete." << endl;
    return 0;
}
Here is the code I used for the Visual Basic 6 Benchmark:

Code:
Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub Command1_Click()
Dim Start As Long
Start = GetTickCount()
Dim arr1(1000) As Byte
Dim i As Integer
Dim j As Integer
For i = 1 To 1000
    For j = 1 To 1000
        arr1(j) = Rnd Mod 100
    Next j
Next i
Dim EndTime As Long
EndTime = GetTickCount()
MsgBox "That took " & Str(EndTime - Start) & " milliseconds to complete."
End Sub
And the Borland Delphi 6 equivalent:
Code:
program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, Windows;
var
i,j,start,endtime:Longint;
data: array[1..1000] of Byte;
begin
  { TODO -oUser -cConsole Main : Insert code here }
  start := GetTickCount();
  for i := 1 to 1000 do
  begin
        for j := 1 to 1000 do
        begin
                data[j] := Random(32767) mod 100;
                // 32767 is the same as RAND_MAX in VC++
        end;
  end;
  endtime := GetTickCount();
  WriteLn('That took ' + IntToStr(endtime-start) + ' milliseconds to finish.');
end.
Java source (thanks Cheese Police):
Code:
public class Benchmark
{
    public static void main(String[] args)
    {
        byte[] data = new byte[1000];
        long start = System.currentTimeMillis();
        for (int i = 0; i < 1000; i++)
        {
            for (int j = 0; j < 1000; j++)
            {
                data[j] = (byte) (Math.random() * 256);
            }    
        }
        long end = System.currentTimeMillis();
        System.out.println((end - start) + " ms");
    }

}
Output:

VB6:
157 milliseconds
156 milliseconds
141 milliseconds
141 milliseconds
140 milliseconds

VC6:
31 milliseconds
16 milliseconds
31 milliseconds
15 milliseconds
31 milliseconds

BD6:
16 milliseconds
31 milliseconds
31 milliseconds
31 milliseconds
31 milliseconds

Java:
125 ms
94 ms
94 ms
94 ms
94 ms

Averages: VB6 - takes 147 milliseconds to fill a 1000 element array 1000 times
VC6 - takes 24.8 milliseconds to fill a 1000 element array 1000 times
BD6 - takes 28 milliseconds to fill a 1000 element array 1000 times
Java - takes 100.2 milliseconds to fill a 1000 element array 1000 times

C++ and Delphi are pretty evenly matched, Java is only slow because of it being bytecode, although, it's obvious here who the clear loser is in terms of speed. The algorithm is exactly the same, yet VB takes significantly longer to run it.
 
Member of the Month Winner
Sythe's 10th Anniversary
I have posted inaccurate benchmarks in the past. This here is a valid one.VC++6, VB6, and Delphi6 are running all program with equivalent algorithms to populate a 1000 element array with random elements 1000 times. (Byte and char types are equivalent in terms of size).

Here is the code I used for the Visual C++ 6 Benchmark:

Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ctime>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
    char data[1000];
    DWORD dwStart = GetTickCount();
    for(int i = 0; i < 1000; i++)
    {
        for(int j = 0; j < 1000; j++)
        {
            data[j] = (char)rand()%100;
        }
    } 
    DWORD dwEnd = GetTickCount();
    cout << "Took " << (dwEnd)-(dwStart) << " milliseconds to complete." << endl;
    return 0;
}
Here is the code I used for the Visual Basic 6 Benchmark:

Code:
Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub Command1_Click()
Dim Start As Long
Start = GetTickCount()
Dim arr1(1000) As Byte
Dim i As Integer
Dim j As Integer
For i = 1 To 1000
    For j = 1 To 1000
        arr1(j) = Rnd Mod 100
    Next j
Next i
Dim EndTime As Long
EndTime = GetTickCount()
MsgBox "That took " & Str(EndTime - Start) & " milliseconds to complete."
End Sub
And the Borland Delphi 6 equivalent:
Code:
program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, Windows;
var
i,j,start,endtime:Longint;
data: array[1..1000] of Byte;
begin
  { TODO -oUser -cConsole Main : Insert code here }
  start := GetTickCount();
  for i := 1 to 1000 do
  begin
        for j := 1 to 1000 do
        begin
                data[j] := Random(32767) mod 100;
                // 32767 is the same as RAND_MAX in VC++
        end;
  end;
  endtime := GetTickCount();
  WriteLn('That took ' + IntToStr(endtime-start) + ' milliseconds to finish.');
end.
Java source (thanks Cheese Police):
Code:
public class Benchmark
{
    public static void main(String[] args)
    {
        byte[] data = new byte[1000];
        long start = System.currentTimeMillis();
        for (int i = 0; i < 1000; i++)
        {
            for (int j = 0; j < 1000; j++)
            {
                data[j] = (byte) (Math.random() * 256);
            }    
        }
        long end = System.currentTimeMillis();
        System.out.println((end - start) + " ms");
    }

}
Output:

VB6:
157 milliseconds
156 milliseconds
141 milliseconds
141 milliseconds
140 milliseconds

VC6:
31 milliseconds
16 milliseconds
31 milliseconds
15 milliseconds
31 milliseconds

BD6:
16 milliseconds
31 milliseconds
31 milliseconds
31 milliseconds
31 milliseconds

Java:
125 ms
94 ms
94 ms
94 ms
94 ms

Averages: VB6 - takes 147 milliseconds to fill a 1000 element array 1000 times
VC6 - takes 24.8 milliseconds to fill a 1000 element array 1000 times
BD6 - takes 28 milliseconds to fill a 1000 element array 1000 times
Java - takes 100.2 milliseconds to fill a 1000 element array 1000 times

C++ and Delphi are pretty evenly matched, Java is only slow because of it being bytecode, although, it's obvious here who the clear loser is in terms of speed. The algorithm is exactly the same, yet VB takes significantly longer to run it.
For VB, did you compile the program and run the .exe or simply run it through the IDE? Compiling the program makes it run "faster".

I don't use any of these, I use code::blocks and C/C++, maybe MSVC# if I need something fast.
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
I actually compiled the VB project before running it. I know what I'm doing lol >_>
 
Code:
program Project2;

uses
 Windows;

function IntToStr(i: Integer): String;
begin
 Str(i, Result);
end;

var
 I, J, Start, EndTime: LongInt;
 Data: array[1..1000] of Byte;
begin
 Start := GetTickCount();
 for I := 1 to 1000 do for J := 1 to 1000 do data[J] := Random(32767) mod 100;
 EndTime := GetTickCount();
 MessageBox(0, PChar('That took ' + IntToStr(EndTime-Start) + ' milliseconds to finish.'), nil, 0);
end.

For me this does:
15 milliseconds
15 milliseconds
16 milliseconds
31 milliseconds
15 milliseconds

Depends on luck... C++ & Delphi are the same speed for this thing xD.
Note: This is on Delphi 2007.
 
Two Factor Authentication User
Here is a C# 3.0 benchmark code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Benchmark
{
    class Program
    {
        [System.Runtime.InteropServices.DllImport("kernel32")]
        static extern Int32 GetTickCount();
        static Random rnd = new Random();

        static void Main(string[] args)
        {
            do
            {
                Console.WriteLine(Bench());
                Console.ReadKey();
            } while (true);
        }

        static Int32 Bench()
        {
            var data = new byte[1000];
            var start = GetTickCount();
            for (var i = 0; i < 1000; i++)
                for (var j = 0; j < 1000; j++)
                    data[j] = (byte)(rnd.Next() % 100);
            var end = GetTickCount();
            return (end - start);
        }
    }
}

My results were:
47
31
46
31
31

The loop is just so I dont have to restart the application each time.
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
Code:
program Project2;

uses
 Windows;

function IntToStr(i: Integer): String;
begin
 Str(i, Result);
end;

var
 I, J, Start, EndTime: LongInt;
 Data: array[1..1000] of Byte;
begin
 Start := GetTickCount();
 for I := 1 to 1000 do for J := 1 to 1000 do data[J] := Random(32767) mod 100;
 EndTime := GetTickCount();
 MessageBox(0, PChar('That took ' + IntToStr(EndTime-Start) + ' milliseconds to finish.'), nil, 0);
end.
For me this does:
15 milliseconds
15 milliseconds
16 milliseconds
31 milliseconds
15 milliseconds

Depends on luck... C++ & Delphi are the same speed for this thing xD.
Note: This is on Delphi 2007.
Yes, I did notice that the speed between Delphi/VC++ is usually quite close.

Here is a C# 3.0 benchmark code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Benchmark
{
    class Program
    {
        [System.Runtime.InteropServices.DllImport("kernel32")]
        static extern Int32 GetTickCount();
        static Random rnd = new Random();

        static void Main(string[] args)
        {
            do
            {
                Console.WriteLine(Bench());
                Console.ReadKey();
            } while (true);
        }

        static Int32 Bench()
        {
            var data = new byte[1000];
            var start = GetTickCount();
            for (var i = 0; i < 1000; i++)
                for (var j = 0; j < 1000; j++)
                    data[j] = (byte)(rnd.Next() % 100);
            var end = GetTickCount();
            return (end - start);
        }
    }
}
My results were:
47
31
46
31
31

The loop is just so I dont have to restart the application each time.
Nice, I would've actually expected .NET results to be close to Java's as .NET is also bytecode - but your computer is probably better than my P.O.S. :P
 
Here's vb.NET 2005
Code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Start As Long
        Start = System.Environment.TickCount
        Dim arr1(1000) As Byte
        Dim i As Integer
        Dim j As Integer
        For i = 1 To 1000
            For j = 1 To 1000
                arr1(j) = Rnd() Mod 100
            Next j
        Next i
        Dim EndTime As Long
        EndTime = System.Environment.TickCount
        MsgBox("That took " & Str(EndTime - Start) & " milliseconds to complete.")
    End Sub
End Class

Results:
265
265
234
250
266
 
VC6:
31 milliseconds
16 milliseconds
31 milliseconds
15 milliseconds
31 milliseconds

I compiled your C++ source with Dev-CPP and came up with an average of 47 milliseconds, considerably worse.
 
Surely these aren't reliable? I mean, after all it depends on the CPU speed too so someone with a not-so-good computer would have even worse results.
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
All the tests that I did were run on the same computer.
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
Here's vb.NET 2005
Code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Start As Long
        Start = System.Environment.TickCount
        Dim arr1(1000) As Byte
        Dim i As Integer
        Dim j As Integer
        For i = 1 To 1000
            For j = 1 To 1000
                arr1(j) = Rnd() Mod 100
            Next j
        Next i
        Dim EndTime As Long
        EndTime = System.Environment.TickCount
        MsgBox("That took " & Str(EndTime - Start) & " milliseconds to complete.")
    End Sub
End Class
Results:
265
265
234
250
266
What speed is your CPU?
 
SMR said:
What speed is your CPU?
Can you post your CPU speed too, I wouldn't think that VC++ should be that much faster than Dev-CPP.

I used an Intel Cored Duo T7200 @ 2.00GHz.
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
I have an emachines running a Pentium IV @ 1.99 GHz (not overclocked, not dual core) with 384 MB RAM. Given that, my computer should be a lot slower than yours.
 
omg i tried this in SCAR:
Code:
program New;
var
  i, time, finishtime, k : Integer;
  Data : array[0..1000] of byte;
begin
  time := GetSystemTime;
  for i:=0 to High(Data) do
  begin
    for k:= 0 to High(Data) do
    begin
      Data[k] := random(32767) mod 100;
    end;
  end;
  finishtime := GetSystemTime;
  writeln('That took '+inttostr(finishtime-time)+' milliseconds to finish.');
end.
That took 24687 milliseconds to finish.

im not lucky.
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
No, use the GetTickCount API - enable API calls then declare it from kernel32.dll.
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
No, learn how to call Windows APIs through SCAR -.- Try dlltest.scar in the Test folder.
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
Because test results will differ on CPU's with varying speed.
 
duelarena.gg
Back
Top