help-octave
[Top][All Lists]
Advanced

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

Re: Realtime cost of call by value


From: Glenn Golden
Subject: Re: Realtime cost of call by value
Date: Wed, 29 Oct 2003 10:16:21 -0700

Hi Tomer,

address@hidden writes:
> 
> I just did a set of timing tests, and I believe that there might be
> some fundamental difference.
>

I agree.  In fact, plotting the call by value and "call by global" timing
separately, rather than the difference between the two, shows it very
clearly.  The call by value time increases roughly linearly in the size
of the array, which is consistent with copy down, while the global times
remain nearly flat. (There is some small growth in the "call by global",
but the absolute value is small [if you correct factor of 10 error in
your program :)] and is not important for my application.)

Thanks very much for demonstrating this! It's good news because it's an
existence proof that it is possible to operate on globals efficiently,
i.e. without copy down. 

This still leaves open my original question though: How does one go
about realizing this behavior in a DLD? (Unfortunately, I can't use
the interpter for what I'm doing for speed reasons, so I have to
do it in a DLD.) 

When I operate on globals along the lines of what was suggested in the
mailing list from several months back (at least as I understood it), i.e.

    OV t = get_global_value("foo");
    A = t.matrix_value();
    A(0,0) = scalar;
    t = A;
    set_global_value("foo", t)

then the timing growth is roughly linear in the size of foo, indicating
that copy down is occurring. (The overhead of the symbol table lookup
washes out for reasonably large foos.)

So what's the correct approach?  How does the interpreter deal with
globals in such a way that copy-down is defeated?  Is it via the
link_to_global_variable() function? If so, how is it used? I have tried
to do my homework here and figure it out myself from the sources, but
unsuccessfully so far.  Anyone?

(My timing DLD attached, showing several approaches, none of which work.)

- Glenn

Attachment: hmmmwrap.cc
Description: hmmmwrap.cc


reply via email to

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