miclog

miclog

How does Elixir speed compare to F# for non-web applications - say, something like a chess game player.

Showing Posts 1 to 10

NobbZ

NobbZ

It depends. Erlang and elixir are not very good in doing only one thing at a time but shine in doing many things at the same time. So it totally depends on how you are able to parallelize the ai (which is the most compute intense part of chess games).

As a rule of thumb you do not choose erlang or any language on its hm VM for speed but for scalability and fault tolerance, which are both easy to achieve as long as one sticks to surrounding idioms.

Probably you want to stick with f# if you only want a single chess ai, but elixir when you want to have a server which gets connected from many clients and acts for all of them as the AI player or if you want to have a server which hosts chess games between humans.

miclog

miclog OP

I might eventually want to parallelize but until then would you estimate Elixir is 2, 5, 10, 20, 50 or 100 times slower than F#? I’m trying to choose a language that is reasonably fast and multi-paradigm with a modern light expressive syntax and able to leverage parallelism. So far it seems a choice between F# and Elixir.

peerreynders

peerreynders

How we program multicores - Joe Armstrong

Our goal is that applications run 0.75 x N times faster on an N-core computer.

(… provided the solution design/implementation can exploit concurrency to a reasonable degree)

So while F#/CLR will likely beat a single BEAM process for sequential code execution, ultimately any F# application will be hampered by the additional complexity needed for the explicit (i.e. manual) handling of synchronization of concurrent activities (not to mention that typically synchronization isn’t an easy problem to solve effectively in CLR languages - or the JVM for that matter).

Also: Erlang and Deep Learning by Garrett Smith

Currently there is seems to be a lot of momentum in the Python community regarding Deep/Machine Learning - but that probably has more to do with a fairly low barrier of entry to the language and environment rather than it being “the right tool for the job” - but for the time being the sheer volume of available libraries is going to keep it going for a while.

However over the past few years a growing number of Python users have been looking for alternatives because of Python’s performance ceiling. Some have chosen Clojure which also seems to make sense for AI applications as the AI pioneers have often used LISP. But Clojure is based on the JVM and therefore can be subject to stop-the-world garbage collection which can be inappropriate in some environments.

In the BEAM there is no stop-the-world garbage collection as each BEAM process has it’s own heap. Therefore Erlang/Elixir could be suitable for AI applications, provided by-and-large concurrent algorithms and strategies are employed.

Springer: Handbook of Neuroevolution Through Erlang (2013)

peerreynders

peerreynders

It really depends on what you are doing. See Speed comparison with Project Euler: C vs Python vs Erlang vs Haskell.

Basically the OPs Erlang code started at 436% of C but was later brought down to 135%.

idi527

idi527

A bit off-topic, there is also Rust, a reasonably fast and modern language, with official bindings [0] to tensorflow. But then there is also Julia …

[0] GitHub - tensorflow/rust: Rust language bindings for TensorFlow · GitHub

AstonJ

AstonJ

I like to think of Elixir as the brain of an app - it excels at sending and receiving lots and lots and lots of messages, concurrently. When your app needs something that is computationally intensive, delegate to something that excels in that area; just like your brain tells vital organs what to do.

Neurofunk

Neurofunk

that’s totally what I had in mind when I wrote this blog post :smiley:

jackalcooper

jackalcooper

If you want multi-paradigm you have to stick to F#. Elixir is functional only.

gjaldon

gjaldon

If you want fast(good for CPU-intensive stuff) and multi-paradigm, then you could use OCaml, F# or Scala. Elixir is not multi-paradigm and the BEAM is not the best for CPU-intensive stuff.

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
jaybe78
Hello, I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter). The diffic...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
widianto
I think I’ve found a small improvement I could contribute to <%= web_namespace %>.CoreComponents (installer/templates/phx_web/compo...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews