zern benchmark 
Author Message
 zern benchmark

info-dylan folks,

after hearing from a few of you it appears that a few points about my Dylan
version of David McClain's Zern benchmark are in order.   first of all,
my version is completely in Dylan, that is requires no external C routines,
but it currently avoids bounds checks with our dylan-extensions
without-bounds-checks macro to attain C++ speeds.  
Unfortunately, our bounds check analysis code is working
internally but is not yet available to our external users.  BTW, I personally,
don't recommend using the without-bounds-checks macro except in the
crunchiest of your code as it does introduce unsafe code into an otherwise
safe language.

Because of the various requests, i've included a source code replacement
(that achieve's 99% of the C++/MSV++/6.0 speed) for the more-tests.dylan file
to be found in david mcclain's zip file as follows:

    Dylan-Bench\Projects\Dylan\fm-math-array\more-tests\more-tests.dylan

please let me know if people have similar experiences with this benchmark.

i would be interested to find out the Gwydion Dylan speed as well.  does Gwydion
Dylan support limited vectors of double floats?

jonathan bachrach
harlequin inc

--->>>> SNIP <<<<---
Module:    more-tests
Synopsis:  Test code for the math array library.
Author:    David B. McClain
Copyright: (C) 1998, MCFA All rights reserved.

define constant <mvector>
    = limited(<vector>, of: <double-float>);

define constant <vmvector>
    = limited(<vector>, of: <mvector>);

define inline method mvscale(dst :: <mvector>,
                             src :: <mvector>,
                             sf  :: <object>) => ();
  let dsf :: <double-float> = as(<double-float>, sf);
  without-bounds-checks
    for(sval keyed-by ix in src)
      dst[ix] := dsf * sval;
    end;
  end without-bounds-checks;
end method;

define inline method mvaccum(dst :: <mvector>,
                             src :: <mvector>,
                             sf  :: <object>) => ();
  let dsf :: <double-float> = as(<double-float>, sf);
  without-bounds-checks
    for(sval in src,
        dval keyed-by ix in dst)
      dst[ix] := dval + dsf * sval;
    end;
  end without-bounds-checks;
end method;

define inline method mvcis(redst :: <mvector>,
                           imdst :: <mvector>,
                           src   :: <mvector>) => ();
  without-bounds-checks
    for(sval keyed-by ix in src)
      redst[ix] := cos(sval);
      imdst[ix] := sin(sval);
    end;
  end without-bounds-checks;
end method;

define method mvector(size :: <integer>,
                      #key
                      fill = 0.0d0) => v :: <mvector>;
  make(<mvector>, size: size, fill: as(<double-float>, fill));
end method;

define method mvtst(nedge :: <integer>,
                    niter :: <integer>) => ();

    let nelts   = nedge * nedge;
    let ncoef   = 15;
    let sum     = mvector(nelts);
    let re-part = mvector(nelts);
    let im-part = mvector(nelts);
    let coef    = mvector(ncoef, fill: 1.5);

    let zern :: <vmvector>
      = map-as(<vmvector>,
               method (ix :: <integer>) => v :: <mvector>;
                 mvector(nelts, fill: 0.1 * ix);
               end method,
               range(from: 1, to: ncoef));

    let (dur :: <integer>, us :: <integer>)
      = timing()
          without-bounds-checks
            for(ix from 1 to niter)
              // the following coercion on zern[0] seems
              // necessary to do away with dynamic dispatch
              // in the inner loop. Doing another coercion
              // on zern[jx] in the loop appears unnecessary...(?)
              let zern_0 :: <mvector> = zern[0];
              mvscale(sum,zern_0,coef[0]);
              for(jx from 1 below coef.size)
                let zern_jx :: <mvector> = zern[jx];
                mvaccum(sum,zern_jx,coef[jx]);
              end;
              mvcis(re-part,im-part,sum);
            end;
          end without-bounds-checks;
        end;

    let titer = as(<single-float>,nelts) * niter;
    format-out("Pixels: %=\n", titer);
    let tdur = dur + us * 1.0e-6;
    format-out("Duration: %=\n", tdur);
    let usdur = (1.0e6 * tdur) / titer;
    format-out("ops/microsec: %=\n", 1.0 / usdur);
    format-out("nsec/op: %=\n", usdur * 1000.0);
end method;

define method main () => ()
  mvtst(128, 10);
  // Your program starts here...
end method main;

begin
  main();
end;



Fri, 08 Jun 2001 03:00:00 GMT  
 zern benchmark

Quote:

> i would be interested to find out the Gwydion Dylan speed as well.  
> does Gwydion Dylan support limited vectors of double floats?

No, there's no support for limited collections yet. We also have no
code for moving bounds checks.

Right now we're working on a new getopt library (the library is finished,
and we're integrating it into our tools), Gtk+ support (much progress
there, melange parses all the Gtk+ headers without manual assistance)
and general cleanup. We hope to release a version 2.2 once all this
is settled, and the last few critical bugs are fixed. Then work on
2.3 will start, which will involve improvements to the compiler itself
(I already finished constant-time instance?, and will work on
constant-time multimethod dispatch).

Andreas

--
If you think C++ is not overly complicated, just what is a protected
abstract virtual base pure virtual private destructor, and when
was the last time you needed one?
                -- Tom Cargil, C++ Journal.



Fri, 08 Jun 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Benchmarks

2. Bad benchmarks vs defensiveness

3. APL vs. Assembler benchmark

4. APL BENCHMARKS

5. APL benchmarks

6. Benchmarks for APL Compilers

7. Adrian Smith's Benchmark

8. STSC APL benchmark

9. Benchmarks wanted

10. MVCL Benchmark Results

11. Performance Benchmarks

12. Hui benchmarks

 

 
Powered by phpBB® Forum Software