dojap

dojap

Any Elixir and/or Erlang wiz kid who could include this language in the primes "competition"

There is an interesting primes “competition” going on using docker containers here (it’s an introduction on how the test works and the first thematicaly similar languages Ada, Pascal and Delphi are tested and ranked):

The github page is here:

https://github.com/PlummersSoftwareLLC/Primes

The author said that new languages could be added.

Elixir and Erlang is currently missing.

I know Elixir/Erlang can’t win, but it would be nice if we could be included and get a nice result :wink:

Most Liked

al2o3cr

al2o3cr

I wonder if precomputing the whole array of “primes up to 1,000,000” and putting it in a module attribute would count as “cheating” :stuck_out_tongue:

defmodule VeryCheatingMuchFast do
  @all_the_primes ComputePrimes.all(1_000_000)

  def all_the_primes do
    @all_the_primes
  end
end
Sebb

Sebb

Warning: I’m not a wiz kid.

The docker part ist easy and docker is also a handy tool to have in your toolbox.

Say you have a script prim.exs in the working directory

# calculate a prime number and print it out
IO.puts(1+1)

Check that you can run it with elixir prim.exs.

Then you can just run this script inside docker with

docker run -it --rm -v "$PWD":/prim -w /prim elixir:alpine elixir prim.exs

docker will automatically fetch the image “elixir:alpine” from elixir - Official Image | Docker Hub. -v and -w do some magic so that docker sees the host-filesystem. The last part just runs the script inside the container.

Last Post!

ityonemo

ityonemo

ok, I got nerdsniped and learned me something about :counters module. 4000x speedup =D

Where Next?

Popular in Discussions Top

ricklove
I was just introduced to Elixir and Phoenix. I was told about the 2 million websocket test that was done 2 years ago. From my research, t...
New
sergio
There’s a new TIOBE index report that came out that shows Elixir is still not in the top 50 used languages. It also goes on to call Elix...
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
lucaong
Hello Elixir and Nerves community, I have been working for a while on an open-source embedded key-value database for Elixir, that I call...
230 14350 124
New
cvkmohan
The upcoming Phoenix 1.6 release looks very interesting. Became a habit to watch the commits - and - what they are bringing in. phx.gen...
New
Rustixir
Hi everyone, im working on find best language/framework/system for high concurrency, high performance and stable performance after wor...
New
AstonJ
Can you believe the first professionally published Elixir book was published just 8 years ago? Since then I think we’ve seen more books f...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130286 1222
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31494 112
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42533 114
New

We're in Beta

About us Mission Statement