- Subject: Re: API
- From: Joerg Sommer <joerg@xxxxxxxxxxxx>
- Date: Mon, 14 Jul 2003 14:18:32 +0000 (UTC)
begin Paul Boekholt <p.boekholt@xxxxxxxxx> wrote:
> On Sun, Jul 13, 2003 at 03:36:33PM +0000, Joerg Sommer wrote:
>> I don't know if slang supports inline-ing, otherwise all these functions
>> wastes time and space, because (correct me if I'm wrong) a direct call of
>> up(1) is faster then up_1().
> Try this.
>
> So go_up_1 takes twice as long to execute, but 0.4 as long to load. Since
> loading takes 3-15 times as long as executing, go_up_1 may be faster. You
> have to run test() 9 times before ()=up(1) starts winning.
Do you know, how often go_up and co. is used?
At me:
#v+
$ cat /tmp/test1.sl
define go_ud_1()
{
go_up_1();
go_down_1();
}
$ cat /tmp/test2.sl
define direct()
{
()=up(1);
()=down(1);
}
$ cat /tmp/test_test.sl
tic();
() = evalfile("/tmp/test1.sl");
toc();
tic();
loop(int(5e5)) { go_ud_1(); }
toc();
vmessage("go_ud_1: loop: %.2lf, eval: %.2lf");
tic();
() = evalfile("/tmp/test2.sl");
toc();
tic();
loop(int(5e5)) { direct(); }
toc();
vmessage("direct: loop: %.2lf, eval: %.2lf");
#v-
#v+
$ xjed -batch -n -f "evalfile(\"/tmp/test_test.sl\")"
go_ud_1: loop: 4.22, eval: 0.00
direct: loop: 2.76, eval: 0.00
$ jed -batch -n -f "evalfile(\"/tmp/test_test.sl\")"
go_ud_1: loop: 4.25, eval: 0.00
direct: loop: 2.78, eval: 0.00
#v-
How you can see, at me the direct call of ()=up(1); is two times faster
then go_up_1(). I don't think loading the code make a differens. So your
results sounds a little bit weird.
Jvrg.
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2003 date index]
[2003 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]