Golang vs Java. Simple Comparison.

preview_player
Показать описание

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

In Java int is 32 bits. On a 64 bit platform Go int is 64 bits. You should change the Go code to use int32, and cast the for loop starting constant to int32 instead of int for a fair comparison.

KevinInPhoenix
Автор

I think this is because, Java has code optimizer and since this is a dead loop, Java is fast in this case but in general go will be faster than Java.

AyushTewari-xp
Автор

This is poorly made test. Java requires the JIT compiler to run at least one time before you get fast exection speed. A warmed up Java system performs in general better than Go on execution time depending on what's your're testing.

pompiuses
Автор

don't use time command, instead measure directly inside the code with timestamp before and after loop, or use benchmark tests. Nevertheles, java won.

fathirirhas
Автор

No wonder that according to speed: assembly > C > Java 😂

ShadowChessMaster
Автор

loop ? where is memory allocation ? garbage collector ? loop doing nothing means nothing

feltrix
Автор

Terrible comparison. Compiler just optimize the code for faster execution. In this case we can say instead of looping it just do n =

kvancturker
Автор

Java won 😂
Never underestimate mature technology 😎

ShadowChessMaster
join shbcf.ru