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

mbenatti
Following https://github.com/tbrand/which_is_the_fastest |> https://raw.githubusercontent.com/tbrand/which_is_the_fastest/master/imgs...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
lorenzo
Hey everone! I created a prototype for my app using Nodejs for the api. But the framework I chose wasnt great (in general theresnt any g...
New
nunobernardes99
Hi there Elixir friends :vulcan_salute: In a recent task I was on, I needed to check in two dates which of them is the maximum and which...
New
crispinb
On reading dhh’s latest The One Person Framework it strikes me that Phoenix with LiveView is already pretty much this. However, never hav...
New
matthias_toepp
I’d love to hear what people think about Wisp, the new Gleam web framework started by Gleam’s primary creator Louis Pilfold. Gleam, alon...
New
arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New

Other popular topics Top

hariharasudhan94
I would like to know what is the best IDE for elixir development?
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
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement