isEmpty empty array vs length empty array vs isEmpty array of strings vs length array of strings vs isEmpty array of objects vs length array of objectsFastest: length array of strings (2.2x faster)
13,394,050 ops/sec
13,346,432 ops/sec
13,277,670 ops/sec
6,071,673 ops/sec
6,068,994 ops/sec
6,048,036 ops/sec
Fastest: length array of strings (1.4x faster)
13,922,714 ops/sec
13,915,781 ops/sec
13,655,184 ops/sec
10,034,676 ops/sec
9,794,017 ops/sec
9,708,181 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| isEmpty empty array | |
| length empty array | |
| isEmpty array of strings | |
| length array of strings | |
| isEmpty array of objects | |
| length array of objects |
| Test name | Executions per second |
|---|---|
| ✓ length empty array | 94,855,456 Ops/sec |
| length array of objects | 92,250,984 Ops/sec |
| length array of strings | 91,710,008 Ops/sec |
| isEmpty array of objects | 21,141,196 Ops/sec |
| isEmpty empty array | 21,140,068 Ops/sec |
| isEmpty array of strings | 21,024,036 Ops/sec |