Ruby best practices: count, length, size
When to use which: Hash size and length both call RHASH_SIZE which is O(1) count is enumerable.count which is O(n) – use only with block best practice: length without block, count with block Array size is an alias for length length calls RARRAY_LEN which is O(1) count is O(n) – use only with block best practice: length …
Continue reading ‘Ruby best practices: count, length, size’ »