On 21/09/2023 20:19, 'Justin Wood' via elixir-lang-core wrote:

Depending on what exactly you are doing, and the size of your lists, it may be worth taking a look at the :array module provided by Erlang. It will give you logarithmic access times, or O(log n). But it still has the downside of not having [] type access.

To add on to that, there are quite a number of excellent libraries on Hex.pm which provide arrays including support for the Access behaviour (which gives you `[]`-indexing and a few other capabilities), such as:

- Aja <https://hex.pm/packages/aja>, which provides a persistent vector based on RRB trees. In some benchmarking I did a year ago <https://elixirforum.com/t/arrays-fast-and-versatile-arrays-with-swappable-implementations/42146/11?u=qqwy>, Aja turned out to be the fastest general-purpose array implementation in Elixir. - Arrays <https://hex.pm/packages/arrays> (written by me), which supports a unified interface to a bunch of different array implementations (such as map-based arrays and Erlang's `:array` module). - Nx <https://hex.pm/packages/nx>, which provides natively-implemented (one- and multi-dimensional) arrays for numbers and can potentially run computations with them on your GPU. - Explorer <https://hex.pm/packages/explorer>, which provides natively-implemented one-dimensional 'series' and two-dimensional 'dataframes'.

Those last two do not allow you to store 'all' kinds of  Elixir datastructures inside them, but they are often more efficient than a library written in pure Elixir when you have a lot of data or do a lot of calculations.


~Qqwy / Marten

--
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/0e73e68d-b345-4032-8cb5-29ecc52363a1%40resilia.nl.

Reply via email to