Irene Langkilde-Geary wrote:
How memory efficient are Mozart records? I'm using a C++ program that takes a 250M data file as input and builds a tree structure in C++ that occupies over 1G RAM when complete. Would it be even close to the same size if I recoded the tree-builder in Mozart, or should I stick to C++?

They are memory efficient. An Oz record of width N occupies a block of N+2 pointers in memory. The two extra pointers are for the label and the arity, which are stored separately. The objects describing arities are never duplicated.

The overhead of the arity might be problematic if all those records have a different arity. But otherwise, there is no contra-indication. Note that tuples are slightly more efficient than full records.

Oz records have some advantages, too. They can store Oz variables. You can unify them, and use pattern matching. IMHO the latter makes many algorithms much more readable than object-oriented code. If memory is a concern, you might also read your input file in a lazy way, and build the part of the tree that you actually need. Moreover, garbage collection is automatic.

My advice is: don't try to reinvent the world, especially in C++. Unless it is necessary.

Cheers,
raph

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to