[Prev][Next][Index][Thread]
Re: Re[2]: Dylan performance
The stack overflow error only occurs in production mode. It does not
occur in interactive mode. This is the exact message: Dylan error:
Stack overflow on current thread, "Master Thread".
If you compile in interactive mode, you see a lot of magenta in the
assignment statements. But in production mode, everything is gray, so I
expect that the code will perform much, much faster in production mode.
This is the program, cleaned up slightly:
Module: dylan-benchmark
define constant <float-array> = limited(<array>, of: <single-float>);
define method calculate (nx :: <integer>, ny :: <integer>, nt ::
<integer>)
let t1 = make(<float-array>, dimensions: list(nx, ny), fill: 0.0);
let t2 = make(<float-array>, dimensions: list(nx, ny), fill: 0.0);
for (k from 0 below nt)
for (i from 1 below (nx - 1))
for (j from 1 below (ny - 1))
t2[i, j] := t1[i, j] + 1.0 + 0.1 *
(t1[i + 1, j] +
t1[i - 1, j] +
t1[i, j + 1] +
t1[i, j - 1] -
(t1[i, j] * 4.0));
end for;
end for;
for (i from 1 below (nx - 1))
for (j from 1 below (ny - 1))
t1[i, j] := t2[i, j] + 1.0 + 0.1 *
(t2[i + 1, j] +
t2[i - 1, j] +
t2[i, j + 1] +
t2[i, j - 1] -
(t2[i, j] * 4.0));
end for;
end for;
format-out("%= \n", t1[150, 150]);
end for;
end method;
define method main () => ()
let (seconds, milliseconds) = timing ()
calculate(300, 300, 10);
end;
format-out("%d seconds %d milliseconds\n", seconds, milliseconds);
end method main;
begin
main();
end;
Sent via Deja.com
http://www.deja.com/
Follow-Ups:
References: