<p dir="ltr">Are the updates so scattered? If they are a series of front-to-back or back-to-front updates, then there's not much of a problem. Certain other fixed patterns (eg, swapping each pair of values, or in general replacing ..., X, Y,... with ..., f(X, Y), g(X, Y),... ) are easy too, with lists or binaries. The really hard case is when the sequence of indexes of the updates is not fixed. Purely functional data structures don't do such patterns too well, performance-wise - although, as has been pointed out by others, it may perform well enough for the purpose.<br>
The "ramfile" driver may be a solution,  although last time I checked it wasn't too fast.<br>
/Erik</p>
<div class="gmail_quote">Den 21/07/2015 09.56 skrev "Jesper Louis Andersen" <<a href="mailto:jesper.louis.andersen@gmail.com">jesper.louis.andersen@gmail.com</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 21, 2015 at 6:00 AM, Hugo Wang <span dir="ltr"><<a href="mailto:w@mitnk.com" target="_blank">w@mitnk.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>In other language, like C or Python, we can init an output list and then update its elements inline. In Erlang, what I currently do, would make a copy of the list every time when an element need to update. This looks not quite right.</div><div></div></blockquote></div><br></div><div class="gmail_extra">Do you have a small snippet of an inner loop somewhere? It may be easier to recommend an approach then. Do note that crypto-stuff in Erlang is perhaps not the best approach since the complexity of the VM makes it harder to account for side channels.<br></div><div class="gmail_extra"><br clear="all"><br>-- <br><div>J.</div>
</div></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div>