use len built-in vs use variable to cache sizeFastest: use len built-in (1.7x faster)
22 ops/sec
12 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| use len built-in | |
| use variable to cache size |
| Test name | Executions per second |
|---|---|
| ✓ use len built-in | 22 Ops/sec |
| use variable to cache size | 12 Ops/sec |