Language test

The comparison was between C# and Java, C was just there as a reference.

The test was performed by running a loop with small calculations and measure the time and resources for each language.

Everything was run in Linux and the FLOSS compilers and VMs(Virtual Machines) available

Test result

Test C/GCC C#/Mono Java
Version 4.1.2 1.9.1.0 1.6.0_07
Flags gcc -O3 ?std=c99 gmcs javac
File size 7.9k 3.0k 738
Time 4.4s 4.6s 4.8s
Process Memory 3.56M/332B 37.3M/5.32M 1174M/12.9M
System Memory 0M 2M 5M

Process Memory was memory usage VIRT/RES reported by top
System Memory was global change in free memory.

Summary

What I first noticed was the speed of the languages compared to C, there were really no significant difference.

The code

int main(void)
{
    int c = 2;
    printf("Start\n");
    for(int a = 1; a < 500000; a++)
    for(int b = 1; b < 1000; b++)
    c = (c + b) % a;
    printf("Stop %i\n", c);
}
Loading comments...