Well here we go. Multiply two random matrices, using 1 thread and 4 threads, on a MacBook Pro with an Intel Core2duo (dual core) processor.
First the program: ///////////////////////////////// macro val N = 200; typedef matrix = array[array[double,N],N]; // Make two arrays var x : matrix; for var i in 0 upto N - 1 do for var j in 0 upto N - 1 do (&x) . i . j <- #rand.double / RAND_MAX . double; done done var y : matrix; for i in 0 upto N - 1 do for j in 0 upto N - 1 do (&y) . i . j <- #rand.double / RAND_MAX . double; done done var z : matrix; // We will multiply z = x * transpose y // using 4 procedures that generate the // 4 sub-matrices of a partition formed by // splitting the row and column axes in half. proc inner_product (z:&matrix,i:int,j:int,x:&matrix,y:&matrix) { var sum = 0.0; for var u in 0 upto N - 1 do sum += *(x . i . u) * *(y . j . u); done z . i . j <- sum; } proc slicemul (z: &matrix, i0:int,i1:int,j0:int,j1:int, x:&matrix, y:&matrix) { for var i in i0 upto i1 do for var j in j0 upto j1 do inner_product (z,i,j,x,y); done done } proc mul00 () => slicemul (&z, 0, N/2, 0, N/2, &x, &y); proc mul10 () => slicemul (&z, N/2 + 1, N - 1, 0, N/2, &x, &y); proc mul01 () => slicemul (&z, 0, N/2, N/2 + 1, N - 1, &x, &y); proc mul11 () => slicemul (&z, N/2 + 1, N - 1, N/2 + 1, N - 1, &x, &y); var t1 = #Time::time; mul00; mul10; mul01; mul11; var t2 = #Time::time; println$ "farray: " + str N + " x " + str N + ": Sequential calculation time = " + str (t2 - t1)+ " seconds"; var t3 = #Time::time; concurrently$ mul00, mul10, mul01, mul11; var t4 = #Time::time; println$ "farray: " + str N + " x " + str N + ": Concurrent calculation time = " + str (t4 - t3)+ " seconds"; ///////////////////////////////// And now the results, varying N: ~/felix>flx --test=build/release mat farray: 50 x 50: Sequential calculation time = 0.000545025 seconds farray: 50 x 50: Concurrent calculation time = 0.00124192 seconds ~/felix>flx --test=build/release mat farray: 100 x 100: Sequential calculation time = 0.004251 seconds farray: 100 x 100: Concurrent calculation time = 0.00256181 seconds ~/felix>flx --test=build/release mat farray: 150 x 150: Sequential calculation time = 0.0147321 seconds farray: 150 x 150: Concurrent calculation time = 0.00751901 seconds ~/felix>flx --test=build/release mat farray: 200 x 200: Sequential calculation time = 0.0347688 seconds farray: 200 x 200: Concurrent calculation time = 0.0178289 seconds ~/felix>flx --test=build/release mat farray: 250 x 250: Sequential calculation time = 0.0671811 seconds farray: 250 x 250: Concurrent calculation time = 0.036303 seconds ~/felix>flx --test=build/release mat farray: 300 x 300: Sequential calculation time = 0.115872 seconds farray: 300 x 300: Concurrent calculation time = 0.06879 seconds ~/felix>flx --test=build/release mat farray: 300 x 300: Sequential calculation time = 0.116257 seconds farray: 300 x 300: Concurrent calculation time = 0.069104 seconds ~/felix>flx --test=build/release mat farray: 300 x 300: Sequential calculation time = 0.116282 seconds farray: 300 x 300: Concurrent calculation time = 0.0671709 seconds ~/felix>flx --test=build/release mat farray: 400 x 400: Sequential calculation time = 0.291108 seconds farray: 400 x 400: Concurrent calculation time = 0.169183 seconds ~/felix>flx --test=build/release mat farray: 500 x 500: Sequential calculation time = 0.622554 seconds farray: 500 x 500: Concurrent calculation time = 0.340475 seconds ~/felix>flx --test=build/release mat farray: 1000 x 1000: Sequential calculation time = 4.99785 seconds farray: 1000 x 1000: Concurrent calculation time = 2.91412 seconds ~/felix>flx --test=build/release mat farray: 2000 x 2000: Sequential calculation time = 45.9944 seconds farray: 2000 x 2000: Concurrent calculation time = 27.488 seconds ~/felix>flx --test=build/release mat farray: 2500 x 2500: Sequential calculation time = 98.6339 seconds farray: 2500 x 2500: Concurrent calculation time = 65.533 seconds -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language