They are - just use NIFs ![]()
There are lots of possible improvements, for example:
- Depending on specific case i.e. you have 2 or more algorithms, benchmark them using
bencheeand use desired solution NIFand related language features not only can speed up code, but also allows to use many non-Elixir libraries.Stream,Flowand other modules instead ofEnum- instead of storing whole enumerable in memory we can read and process them separately.. Similarly we can process multiple list elements at the same time. There are lots of solutions depending on what you want to achieve- Metaprogramming i.e. improve runtime code by for example generating a pattern-matching
- Try to limit piped
Enumcalls, so iterate one list as few times as possible, often[head | tail]-based recursive function orEnum.reduce/3is useful in such cases.
Please remember that there is no #1 optimisation. Sometimes you optimise resources usage and sometimes you use all available resources to speed up the work. Also it’s worth to mention that raw speed it not always welcome if you have to write very strict code. Often writing more generic code without every possible optimisation may save you huge amount of time in case you would be rewriting or enhancing it by supporting more structs and so on … Again, there is no a single good solution here as it’s very case-specific topic.






















