Performance Comparison: '+' vs. Math.addExact #java #shorts #coding #airhacks

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

Java used in this short: openjdk version "21" 2023-09-19 LTS

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

Nice result. Maybe because x86 architecture is great and CPU already checks integer overflow.

IgorYegorkin
Автор

Try more complex scenarios, branch predictions in a loop so tight might optimize all the branches, or almost all of them. If you made a more complex program the compiler might not predict it so well. Try adding some other branches inside the loop and other stuff, stimulating a real scenario, and most probably it won't be so efficient.

tharteon
welcome to shbcf.ru