jed-users mailing list

[2003 Date Index] [2003 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Slang performance of jed


Joerg Sommer <joerg@xxxxxxxxxxxx> wrote:
>$ jed --script perf.sl
>0.92, 1.81,
>$ jed perf.sl -f evalbuffer
>0.92, 1.81,
>$ xjed --script perf.sl 
>0.92, 1.81, 
>$ xjed perf.sl -f evalbuffer
>6.71, 5.8

The reason the last version is different is that Xjed is being run in
"interactive" mode.  In that case, Xjed installs an event handler in
S-Lang's inner interpreter so that X events can be handled while code
is being executed.  For example, "while(1);" would put the interpreter
into an infinite loop, nevertheless, Xjed would continue to handle
events, redraw itself when necessary, etc.

Also, your test is somewhat flawed.  You are comparing:

    $2 = 0; !if ($2) { }

to

    $2 = 0; if ($2 != 0) { }

In the first case, the interpreter "executes" the do-nothing block {}
whereas in the second case it does not.  When the do-nothing block
executes, the Xjed event handler will also get called.  In fact, this
event handler will get called twice as many times in the first case
than in the second.  A better test would be to use:

    $2 = 1; !if ($2) { }

and

    $2 = 1; if ($2 != 1) { }


That is, call perf via:

  perf( int(1e6), "$2 = 1", ["!if($2)", "if ($2 != 1)"]);

You should see more consistent results.

It is good that you are questioning things by benchmarking slang.  You
might be interested in seeing how slang compares to other languages,
e.g., python, by looking at the The Great Win32 Computer Language
Shootout at http://dada.perl.it/shootout/.

Thanks, 
--John

--------------------------
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]