[metapost] memory problem

Stephan Hennig mailing_list at arcor.de
Mon May 8 18:38:08 CEST 2006

Denis Roegel schrieb:
> On Mon, May 08, 2006 at 12:06:24AM +0200, Stephan Hennig wrote:
>> For a realistic example: the following code draws a binary tree of depth
>> 3 (15 nodes) and runs for seconds! Running time for drawing a tree of
>> depth 4 with a tremendous number of 31 nodes is beyond my tolerance.
> I think there are two problems which need to be separated.
> First, metaobj keeps track of a lot of information,
> and sometimes there may be more optimal workarounds.

Denis, it is not my intention to blame MetaObj for its resources
consumption. In the manual you're very well describing the reasons for
storing path information the way it is. I think drawing trees, graphs,
networks -- logical structures -- are one important application of
MetaPost and it should have been designed for that task. (I know it
wasn't.) Drawing them by hand, resource economic, would be a pain. I do
welcome a high-level library such as MetaObj very much. And perhaps
MetaPost shouldn't care about an equation more or less.

> In the case with rounded corners boxes in metaobj, it would
> be possible to get rid of the stored equations by doing
> a bit more work when drawing. Maybe I will do it.
> But this doesn't solve the whole problem, because the user
> may still want to add some special path to an object, and
> he may want this path to be transformed along with the object.

Maybe there could be two flavors of objects, heavy-weight and
light-weight ones, where the former allows transforms whereas the second
doesn't. (Besides the performance gain, with your workaround I was able
to create a much larger number of objects than without.)

Stephan Hennig

More information about the metapost mailing list