Length 10 temp swap vs Length 10 destructuring swap vs Length 100 temp swap vs Length 100 destructuring swap vs Length 1000 temp swap vs Length 1000 destructuring swapFastest: Length 10 destructuring swap (11.0x faster)
31,348,802 ops/sec
24,476,852 ops/sec
14,973,391 ops/sec
13,547,130 ops/sec
2,908,015 ops/sec
2,839,740 ops/sec
Fastest: Length 10 temp swap (31.3x faster)
10,745,978 ops/sec
8,405,135 ops/sec
3,315,364 ops/sec
3,261,034 ops/sec
377,085 ops/sec
343,291 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Length 10 temp swap | |
| Length 10 destructuring swap | |
| Length 100 temp swap | |
| Length 100 destructuring swap | |
| Length 1000 temp swap | |
| Length 1000 destructuring swap |
| Test name | Executions per second |
|---|---|
| ✓ Length 10 temp swap | 10,288,681 Ops/sec |
| Length 10 destructuring swap | 6,725,437 Ops/sec |
| Length 100 destructuring swap | 2,823,133 Ops/sec |
| Length 100 temp swap | 2,771,988 Ops/sec |
| Length 1000 destructuring swap | 957,672 Ops/sec |
| Length 1000 temp swap | 901,148 Ops/sec |