<div dir="ltr">Hi Jesper & Erik,<div><br></div><div>The updates has inner loops and not that fixed patterned. The code will look like the following after a lot of simplicities:</div><div><br></div><div>void decode(char * src, char * dst, ...) {</div><div>  ...</div><div>  hash_buffer(...);  // random updates</div><div>  ... // other stuff</div><div>  has_buffer(...);</div><div>  ...</div><div>}</div><div><br></div><div>void hash_buffer(...) {</div><div>  ...</div><div>  shift_buffer(...);</div><div>  ...</div><div>  shift_buffer(...);</div><div>  ...</div><div>} </div><div><br></div><div>void shift_buffer(...) {</div><div>  ... // updating elements in dst</div><div>}</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 22, 2015 at 1:16 AM, Erik Søe Sørensen <span dir="ltr"><<a href="mailto:eriksoe@gmail.com" target="_blank">eriksoe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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.<span class="HOEnZb"><font color="#888888"><br>
/Erik</font></span></p>
<div class="gmail_quote"><div><div class="h5">Den 21/07/2015 09.56 skrev "Jesper Louis Andersen" <<a href="mailto:jesper.louis.andersen@gmail.com" target="_blank">jesper.louis.andersen@gmail.com</a>>:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><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></div></div><span class="">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">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></span></blockquote></div>
</blockquote></div><br></div>