# [metapost] Re: Asymptote

John Bowman bowman at math.ualberta.ca
Sun Aug 28 07:34:04 CEST 2005

```Hi Laurent,

> You have been busy with your 2 partners!

One of them, Andy Hammerlindl, is now one of your graduate students.

>
> One suggestion concerning the Asymptote web page:
> The sample graphics should be offered in a

Simply clicking on the Asymptote gallery images will download a pdf file.
Clicking on the name will show you the source code.

>
> Questions:
>
>  --- How does "Asymptote" compare with "metapost"
> in speed of execution?  Benchmarks?

This MetaPost example takes 0.3 seconds on a 1.4GHz IBM T41 laptop:

beginfig(-1);

for n=1 upto 6:
for m=1 upto 1000:
draw (100,0)..(0,100)..(-100,0)..(0,-100)..cycle;
endfor;
endfor;

endfig;
end

This equivalent Asymptote code takes 0.65 seconds when run with the --noplain
option:

frame f,preamble;
pen p;

for(int i=0; i < 6000; ++i)
draw(f,(100,0)..(0,100)..(-100,0)..(0,-100)..cycle,p);

shipout("",f,preamble,"",false,new transform[],new bool[]);

Normally, we draw to pictures, which due to the deferred drawing & simplex
linear programming problem, slow things down to 2.1 seconds. But that is
only because it is doing more work:

size(100);
for(int i=0; i < 6000; ++i)
draw((1,0)..(0,1)..(-1,0)..(0,-1)..cycle);

>
>  --- What is your approach to 3D?

It's a 3d extension of John Hobby's algorithms on page 131 of
Knuths's monograph The MetaFontbook (which I'm planning on submitting to
Discrete & Computational Geometry soon). See the surface.asy example and the
documentation of the three.asy module to get an idea about what we have done.

I hope you enjoy using Asymptote,

-- John

John Bowman
University of Alberta

```