Ruby

Ruby

Made by DeepSource

Do not compute the size of statically sized objects RB-PR1010

Performance
Major

Sizes of objects that we know to be static should not be computed.

For example, we know the size of array in the snippet below to be 3. We can directly use the value instead of calculating it first.

Bad practice

[1, 2, 3].count

Recommended

[1, 2, *arr].count