if your only concern is memory usage, then stick to C/C++.
I disagree. Data structures in Mozart are quite memory efficient.
Lists use two
words per list element. Records take N+2 words. Tuples take N+1 words.
Dictionaries are especially efficient: they grow and shrink as
necessary. Data
structures have good implementations in Mozart. There is really no
reason to
reinvent the wheel in C++.
I think that there are a few issues with Oz here: arities and limitation
to the basic Oz types (yes, new ones can be implemented in C++ ;-)),
should some of the non-builtin data structures seem more fit.
On the contrary, the atom table may help reduce space occupied by
strings if they occur repeatedly, and arities may help speed up lookup
(but both can be implemented in C++ easily - e.g. using a hash_map).
But the point of my message was not to claim that Oz data representation
is inefficient!! (And actually I think that it is.) I just wanted to
point out that when you get a 1GB memory footprint for 250MB data, it is
a sign of poor implementation in C++, and that some minor corrections of
the existing code might bring the desired results faster than rewriting
the thing to Oz.
The only reason to use C++ is for performance, and even there usually
for only
a small part of the program (i.e., write it all in Oz, profile it, and
rewrite a small
part in C++). What's more, some of the more sophisticated parts of Oz,
such
as the lightweight threads and the constraint solver, are already
written in C++!
The lesson is don't give up too quickly on high-level languages.
Yes, but the question was strictly about minimal memory footprint. I
suggested to invest some limited effort into "optimization" of the
existing code rather than rewriting the whole thing to Oz, hoping that a
straightforward rewrite of the C++ code in Oz would consume less memory.
I'm in no case a fan of reinventing the wheel, but I'm no fan of
rewriting existing code when there is no reason either.
Two more comments:
1. IMHO C++ has become quite high-level in recent years, if you stick to
the standard containers.
2. Oz is cool - I think we'll agree on this :-)
I think that although you can achieve (I think that with no effort)
better memory behavior in C++ than Oz (not only consumption, but also
fragmentation etc.), Oz may be more suitable for some operations on the
data. But this is beyond the topic, isn't it?
Cheers,
Filip
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users