[clean-list] The Clas library

John van Groningen johnvg@cs.kun.nl
Tue, 23 Oct 2001 16:04:24 +0200


Siegfried Gonzi wrote:

>...
>
>Timings:
>
>Macintosh:
>
>The above method works and delivers for test cases the same solution as
>compared to Yorick. But there remains one fact which bothers me:
>
>Yorick is about 2 times faster!
>
>It is quite interesting that Yorick and Clean takes for the
>LU-factorization
>with a great array (300x300) nearly the same time (about 10sec). But
>then
>Yorick takes only about 5sec for the forward- and backward substitution
>as
>opposed to Clean with 20sec. This all on a 100MHz Macintosh (603e
>processor).
>
>...

You can make the forward- and backward substitutions faster by replacing
the function 'dot' in Clas1.icl by:

dot :: !.Vector !.Vector -> Real
dot x y
	#! s = min (size x) (size y)
	# r = dot_i 0 0.0
		with
		dot_i :: !Int !Real -> Real
		dot_i i acc 
			| i<>s
				= dot_i (inc i) (acc + (x.[i] * y.[i]))   
				= acc
	= r

and adding the ! for the second argument in the type of 'dot' in Clas1.dcl.

On my Macintosh your program executes about 1.6 as fast after this modification.

By using the 'fmadd' instruction, instead of 'fmul' and 'fadd', the program 
executes even faster, about 20 percent. Clean 1.3.3 does not generate these
instructions but the current development version of the compiler can
(but this is not yet supported by the IDE).

Regards,

John van Groningen