if statement VS Math.min

Benchmark created on


Description

최소값 갱신에 조건문과 Math.min 성능을 비교하는 테스트

Setup

let min = Infinity

Test runner

Ready to run.

Testing in
TestOps/sec
if statement
for(let i = 100; i < 0; i--){
	if(i < min) min = i
}
ready
Math.min
for(let i = 100; i < 0; i--){
	min = Math.min(min, i)
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.