[erlang-patches] [erlang-questions] How to Update List Elements A Lot
ruanbeihong
ruanbeihong@REDACTED
Tue Jul 21 09:45:30 CEST 2015
I think it's the last thing to think about when writing codes. You'd expect the compiler to do such 'update inline' optimization for you.
I'm not quite sure that the compiler do does that kind of optimization, but I will consider to use C port when performance is really critical problem when profile test proved it.
On Tuesday 21 July 2015 12:00:04 Hugo Wang wrote:
Hi all,
I'm writing an encrypt/decrypt stuff in Erlang, the input and output are both lists (or binary). In other words, I need to generate a list of bytes based on another list of bytes. During the generating there are a lot of band, bor, bxor, bsl, bsr, etc operations. Every element in the new list (the output) would be updated many times.
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.
Any comments/ideas on this? I want to use pure Erlang to implement it, rather than making a C port.
Thanks,
Hugo
James Ruan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20150721/8361f77a/attachment.htm>
More information about the erlang-patches
mailing list