Java vs CSharp Speed Test 🔥

preview_player
Показать описание
A speed test between Java and CSharp

#java #csharp #speedtest
Рекомендации по теме
Комментарии
Автор

Dude, you are using mono runtime for C#.
Use DOTNET 7 instead.

AcidNeko
Автор

There is no way. C++ takes 2 full seconds to count to 1 Billion.

plashplash-fghd
Автор

dude you know that because you arent using I in anything the compiler may optimize the code but assigning the 1B to it directly?

deeperlayer
Автор

don't trust this video. this benchmark is too simple and with a huge error in the result

lavshyak
Автор

I did the same test using dotnet 7, but instead of using I used a bigger number 340282366920938463463374607431768211455, witch is the max value that an unsigned Integer of 128 bits (UInt128) can store, and the result was a bit different, so it took 00:00:00.0000561 to execute it.

marceloalvesguitar
Автор

I also tested it myself. The results are the same. Good video!

freedom-jtot
Автор

Well if you run more complex benchmark, C# is vastly faster. For example generating random numbers, sorting them, and calculating the median.

C# Time taken: 721 ms
Java Time taken: 1049 ms

using System.Diagnostics;

class Program {
static void Main() {
var stopwatch = Stopwatch.StartNew();

var rand = new Random();
var list = new
for(int i = 0; i < list.Length; i++) {
list[i] = rand.Next();
}

Array.Sort(list);

double median;
if (list.Length % 2 == 0)
median = ((double)list[list.Length/2 - 1] + list[list.Length/2]) / 2;
else
median = list[list.Length/2];

stopwatch.Stop();

Console.WriteLine(median);
Console.WriteLine($"Time taken: ms");
}
}

chillydill
Автор

Aren't you ashamed to publish such nonsense? At runtime java does not count anything, because the result is calculated at compile time. Time for java is times of displaying the result, not calculations. And from your 'benchmark' it seems that java is also many times faster than C, C++ and Rust.

piotrc
Автор

Mybe I should just find this funny but it makes me really angry.

robinbosch
Автор

Try on your own PC. View come might be instead of 1Billion ur expecting rea billion 😂😂😂😂

codeapi
Автор

plz, call me back when each of their fans has been commented the 'correct' way to do it

mrsurver