[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] MacPerl speed vs MachTen FORTRAN



>slower.  I've changed a DO (ie FOR) loop to a WHILE (supposed to be faster
>from Programming Perl) and am PUSHing each element onto the array.  This
>speed things up a little bit, I think.

I will advice much more when you show the original fortran code.

Now I have one advice for you:

You should not use push() when you know a number of elements of array.

Instead of that, you can prepare the room in memory for array in many way;
for example,
	@a=(0) x 100;
or
	$a[99] = 0;


>   while( $i <= ($nF-1) ) {
>#      print STDOUT "  BETAINVER i = $i\n";
>      $x = $i*$dF;
>      $F = &BETAI($a,$b,$x);
>      if($F == -9999) {
>         $flag = -9999;
>         $betainverseref = "";
>         return $betainverseref, $flag;
>      }
>      push(@$betainverseref, $F);
>      $i++;
>   }
>   return $betainverseref, $flag; 

so, try

	@$betainverseref = (0) x $nf;
	$x = 0.0;
	foreach (@$betainverseref) {
		last if ( ($_ = $F= &BETAI($a, $b, $x)) == -9999)
		$x += $dF;
	}
	i ($F == -9999) {
		return "", -9999;
	}
	return $betainverseref, 0;

>Basically, my question to all of you is: Should I expect MacPerl to run
>slower than FORTRAN on MachTen?  Seems amazing to me since I'd expect
>working in the native MacOS to be faster than an emulated Unix.

I think the applications under "MachTen" do not run in emulation.
Therefore, in most case, they may run not slower than the same
things under MacOS, I think.

Your FORTRAN application may use full CPU time, that MachTen asign,
to perform your compiled program.

Instead of this, Perl is interpreter.  Therefore, your perl script
cannot run directory on CPU.

So, generaly, the calculaton by FORTRAN application is much faster
than Perl script.  However, I believe that there are quite many 
advantages in Perl.


-------------------------------------------------
Mamoru Yamanishi <yama@biotech.okayama-u.ac.jp>
+81-86-251-8196(voice), +81-86-251-8264(GIII fax)
Biotech. Dept., Okayama Univ.



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch