You weren’t sorting by strings, you were sorting by count (they second value in the tuple). The output was correct. At least in the version I got from your gist.
defp report_sort(entries), do: Enum.sort(entries, fn {_, lhs}, {_, rhs} -> lhs > rhs end)
With List.keysort they get sorted in reverse order though (asc instead of desc). There doesn’t seem to be an option to choose order? But yeah, it’s faster
nice find! Something like 200-400ms after a few runs.
And a message to everyone in the thread: I just want to point out that all my measurements are with the output printed to terminal, unless otherwise specified. Just to be clear. Running with > /dev/null or > outputfile is much faster.




















