[Bese-devel] [Fwd: parenspeed]

evrim at core.gen.tr evrim at core.gen.tr
Sun Apr 6 03:18:09 UTC 2008


---------------------------- Original Message ----------------------------
Subject: parenspeed
From:    evrim.ulu at core.gen.tr
Date:    Sun, February 10, 2008 8:05 pm
To:      aycan at core.gen.tr
--------------------------------------------------------------------------

i was working on a new javascript compiler (compiled part is the render.

Assume usual parenscript js interpreter:
SERVER> (js ((lambda (a b)
                (if a
                    (- a b)
                    (+ a b))) 3 4))
"(function (a, b) {
   if (a) {
     a - b;
   } else {
     a + b;
   };
 })
(3, 4);"

New compiler:
SERVER> (js+ ((lambda (a b)
                (if a
                    (- a b)
                    (+ a b))) 3 4))
inside LAMBDA-APPLICATION-FORM
inside APPLICATION-FORM
inside IF-FORM
inside VARIABLE-REFERENCE
inside APPLICATION-FORM
inside VARIABLE-REFERENCE
inside VARIABLE-REFERENCE
inside APPLICATION-FORM
inside VARIABLE-REFERENCE
inside VARIABLE-REFERENCE
inside LAMBDA-FUNCTION-FORM
inside VARIABLE-REFERENCE
inside VARIABLE-REFERENCE
inside CONSTANT-FORM
inside CONSTANT-FORM
"(function (a,b) {
if (a) {
(a - b);
} else {
(a + b);
}
})(3,4);"
SERVER>

Let's check speed on quad.core.gen.tr:

Parenscript results:
SERVER> (time (loop for i from 0 upto 100000
                   do (js ((lambda (a b)
                             (if a
                                 (- a b)
                                 (+ a b)) 3 4)))))
Evaluation took:
  17.282 seconds of real time
  17.061066 seconds of user run time
  0.48403 seconds of system run time
  [Run times include 2.025 seconds GC run time.]
  0 calls to %EVAL
  0 page faults and
  3,441,972,576 bytes consed.
NIL

New compiler results:
SERVER> (time (loop for i from 0 upto 100000
                   do (js+ ((lambda (a b)
                             (if a
                                 (- a b)
                                 (+ a b)) 3 4)))))
Evaluation took:
  12.562 seconds of real time
  12.508781 seconds of user run time
  0.116007 seconds of system run time
  [Run times include 0.5 seconds GC run time.]
  0 calls to %EVAL
  0 page faults and
  902,786,864 bytes consed.
NIL


Interestingly new compiler is fast. Also, mem usage is 2/3 or 3/4 decreased.
Hope to implement indentation and more tests.

Evrim.





More information about the bese-devel mailing list