[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simpe Gwydion question
Andreas Bogk (andreas@andreas.org) wrote:
: > works as slow as previously -- many times slower then C, 15 times slower
: Could you post the code for comparison please? It's hard to say
: whether that's an oversight in your code or the compiler without
: seeing the code.
Well, heapsort is on another machine (off-line) but the following
shows the problem:
define constant <my-double-vector> = limited(<vector>, of: <double-float>);
define function vector-foo(dvec :: <my-double-vector>) => ();
let n :: <integer> = dvec.size;
for (i :: <integer> from 0 below n)
dvec[i] := dvec[i] + 1.64;
end for;
end vector-foo;
define method main (argv0 :: <byte-string>, #rest noise)
let ary :: <my-double-vector> =
make(<my-double-vector>, size: 10000, fill: 0.0);
for (i from 1 to 100)
vector-foo(ary)
end for;
/* Printout so result is used */
if(ary[99] > 30)
format("Good\n");
else
format("Bad\n");
end if;
end;
It takes 1.23s on 800 MHz Athlon.
If I make scalar computations, then d2c uses C doubles for arithmetic,
but vectors are handled by generic code. I tried to make upper limit
fixed (defeats my purpose, but ...) however program runs only slightly
faster.
--
Waldek Hebisch
hebisch@math.uni.wroc.pl or hebisch@hera.math.uni.wroc.pl