Erlang/Elixir string performance - can this be improved?

It runs in about 8.7 seconds on my laptop. I expect that it’s super dependent on how many cores a machine has.