Are you sure your output is correct? I ran your code and you have lots of \n in your words, because you split only on " ". Each line ends with a \n. Remove your argument to split, so it says &String.split(&1) or use my solution of compiling a pattern. Also running your code took
37520.331ms
:timer.tc/1 37520331
Maybe you run it faster because your words.txt is too short? Here’s the number of lines in mine
wc -l words.txt
1819045 ../words.txt
You can also read the number of lines in your output. This is how many lines I get from your code (you get almost twice as many lines in your output because of all the new line characters, I believe you should get 557K if your original file has 1.8M lines)
elixir wc.exs < ../words.txt | wc -l
935401
If you look at the original article the fastest C version took 3.7s, so there’s probably something wrong here ![]()


















