miclog

miclog

Speed vs F#

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

Most Liked

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.

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.

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)

StefanHoutzager

StefanHoutzager

Erik Meyer wrote http://queue.acm.org/detail.cfm?id=2611829 on multi-paradigm.

Conclusion

The idea of "mostly functional programming" is unfeasible. It is impossible to make imperative 
programming languages safer by only partially removing implicit side effects. Leaving one kind of 
effect is often enough to simulate the very effect you just tried to remove. On the other hand, 
allowing effects to be "forgotten" in a pure language also causes mayhem in its own way.

Unfortunately, there is no golden middle, and we are faced with a classic dichotomy: the 
curse of the excluded middle, which presents the choice of either (a) trying to tame effects 
using purity annotations, yet fully embracing the fact that your code is still fundamentally 
effectful; or (b) fully embracing purity by making all effects explicit in the type system and 
being pragmatic by introducing nonfunctions such as unsafePerformIO. The examples shown 
here are meant to convince language designers and developers to jump through the mirror 
and start looking more seriously at fundamentalist functional programming.
rvirding

rvirding

Creator of Erlang

I most definitely agree with this. While you might program in a functional style on an imperative language you are never really safe and can’t trust it.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
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
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New

Other popular topics Top

openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

We're in Beta

About us Mission Statement