Credence.Rule.AvoidGraphemesLength (credence v0.2.0)

Copy Markdown

Performance rule: warns when String.graphemes/1 |> length() is used.

String.length/1 is significantly more efficient. String.graphemes/1 allocates a list of all graphemes in memory, which is then traversed by length/1 and immediately garbage collected.

String.length/1 avoids building this intermediate list.