dimroc / etl-language-comparison

Count the number of times certain words were said in a particular neighborhood. Performed as a basic MapReduce job against 25M tweets. Implemented with different programming languages as a educational exercise.
http://blog.dimroc.com/2015/11/14/etl-language-showdown-pt3/
186 stars 33 forks source link

Add README.md to Elixir implementation #25

Closed dimroc closed 8 years ago

dimroc commented 8 years ago

Hi @josevalim, Would it be possible to add a README.me to the elixir/ folder discussing the different implementations?

I'm trying to go through each language's implementation and add a README and think you're the best guy for the job :+1:

josevalim commented 8 years ago

I can do this but not earlier than 2 weeks, sorry. Ping me in case I forget.

dimroc commented 8 years ago

Ok, sounds good

dimroc commented 8 years ago

Ping @josevalim

josevalim commented 8 years ago

Sorry, I can't provide a full README but I don't want to hold this for any longer. So I will send some text and I hope you can complement it as you find more appropriate. Sorry for the delay!


The Elixir implementation has provides a mapreduce mix task that receives either "binary" or "regex" as argument. The argument chooses which module will do the mapping over each files. Once mapping is performed with each file in a different Elixir process, the result of the mapper is returned to a single reducer process which sums up all counts.

The "binary" argument chooses a BinaryMapActor which uses binary matches provided by the Erlang VM to lookup for matches. Because binary matches are not case insensitive, the first step of the mapper algorithm is to generate all permutations for the word being counted.

The "regex" argument chooses a RegexMapActor which uses regular expressions and are often slower than binary matches.

Generally speaking, both solutions could be further optimized although we believe the current code provides a good trade-off between clarity and performing more low-level optimizations. Other than that, we expect future Elixir versions to yield even better results. For example, Elixir 1.2 introduces support to large maps which will perform faster than HashDict.

dimroc commented 8 years ago

This will do just fine, thanks @josevalim