octave-maintainers
[Top][All Lists]
Advanced

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

Re: Possible starting point for Octave Compiler?


From: JD Cole
Subject: Re: Possible starting point for Octave Compiler?
Date: Mon, 09 Dec 2002 09:46:00 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827

Initially I was considering do a straight m-file to octave C++ translation. I haven't had any experience with compiling Matlab scripts so I was wondering, when compiling a script, does it decend into each function, emitting code for those as well, or does it only emit the script provided?

Thanks,
JD

Paul Kienzle wrote:

You will want to look at tree_walker in the octave/src directory, which
allows you to walk the parse tree.  It is used in pt-check, pt-pr-code
and pt-bp.  It walks the parse tree for a function, visiting each node
in turn.  You need to write the action you want for each node type.

As a first step I would like Octave to spit out a byte code for the likes
of Parrot or some other virtual machine.  Parrot in particular because
it is intended to be used by scripting languages, but Java byte code or
.NET CLR would also be interesting.

All of these machines have JITs available for compiling the byte code.

A couple of years ago I did an experiment in which I translated the
an m-file version of cumsum to C++ by hand:

        y = zeros(size(x));
        total = 0;
        for i=1:length(x)
           total = total + x(i);
           y(i) = total;
        endfor

IIRC, I got a 6x speedup from a direct translation using octave_value
for x,y,i and total.  As optimized C, this loop was about 5000x faster.
In Python, this loop was 100x faster.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]