Upcoming article in Dr. Dobbs'
Mon Jan 10 23:16:40 CET 2005
Jeff Einhorn wrote:
> As a novice Erlang user I found Erlang to be much
> more CPU intensive when compared to Java in
> situations when I was developing applications that
> needed to constantly change\manipulate data
> structures. My observation was that this was a
> result of the constant destroying\recreating of the
> data structures as result of their manipulation.
I have found that it takes time to move to an Erlang
mindset. The particular aspect you mention is common
to many functional languages.
The trick is not to send whole data structures
around. Create functions that act on specific
arguments, and extract those from the large structure
/before/ calling the functions.
Another possibility is using ETS tables, or data
structures from the library (dict, for example) that
are at least reasonably optimised. In any event, all
this is just optimization. Don't worry about it until
you have isolated an actual problem. In the meantime,
your code will be clearer, and more correct.
> Are there any plans to add a C type data structure
> where items could be changed in place, without having
> to recreate the entire data structure?
That would rather spoil the whole point of using a
single-assignment functional language...
More information about the erlang-questions