Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1
Mobile Safari 17
iOS 17.5.1
Mobile
2 years ago
Length 10 destructuring swap
3.0M/s
Length 10 temp swap
2.9M/s
Length 100 destructuring swap
2.5M/s
Length 100 temp swap
2.5M/s
Length 1000 destructuring swap
1.2M/s
Length 1000 temp swap
1.2M/s
View exact numbers
Test name Executions per second
Length 10 destructuring swap 2,961,273 Ops/sec
Length 10 temp swap 2,938,327 Ops/sec
Length 100 destructuring swap 2,477,065 Ops/sec
Length 100 temp swap 2,451,464 Ops/sec
Length 1000 destructuring swap 1,177,106 Ops/sec
Length 1000 temp swap 1,162,430 Ops/sec
Script Preparation code:
Tests: