Prothon gets Major Facelift in Vers 0.1.0 [Prothon]
Jacek Generowicz
jacek.generowicz at cern.ch
Tue May 25 06:11:42 EDT 2004
Ryan Paul <segphault at sbcglobal.net> writes:
> On Sat, 22 May 2004 22:53:01 -0700, simo wrote:
>
> > One thing that might attract me from Python to Prothon is if it had
> > proper private medthods - i.e. not just name mangling like __myDef
> > which can be overridden using _myClass__myDef (as the interpreter
> > does).
> >
> > Proper encapsulation is needed before the C++ brigade will take
Don't confuse encapsulation with access restriction.
> I dont understand why everybody seems to want a machinecode
> compiler.
Actually, my impression is that most (at least many) around here don't
want one.
> It wont make a high-level, dynamically typed language run any
> faster.
Your claim is false.
Proof by counterexapmle:
CL-USER 1 > (defun fib (n)
(if (< n 2)
1
(+ (fib (- n 1)) (fib (- n 2)))))
FIB
CL-USER 2 > (time (fib 35))
Timing the evaluation of (FIB 35)
user time = 66.330
system time = 0.000
Elapsed time = 0:01:06
Allocation = 5488 bytes standard / 328476797 bytes conses
0 Page faults
Calls to %EVAL 8388522
14930352
CL-USER 3 > (compile 'fib)
FIB
NIL
NIL
CL-USER 4 > (time (fib 35))
Timing the evaluation of (FIB 35)
user time = 1.000
system time = 0.000
Elapsed time = 0:00:01
Allocation = 1216 bytes standard / 2783 bytes conses
0 Page faults
14930352
Looks like compiling this partucular high-level dynamically typed
language makes it run considerably faster. Let's repeat the exercise
for 3 more implementations of this particular language I just happen
to have lying around on my machine, and compare it to Python's
performance on the equivalent program:
>>> def fib(n):
... if n<2: return 1
... return fib(n-1) + fib(n-2)
...
>>> import time
>>> a=time.time(); fib(35); time.time() - a
14930352
20.425565958023071
Here are the results gathered in a table:
Name Interpreted Compiled
LispWorks 66 1.0 s
Clisp 41 9.5 s
CMUCL Got bored waiting 1.5 s
SBCL Compiles everything 1.6 s
Python Compiles everything 20 s
So, we have times of 1.0s, 1.5s, 1.6s, 9.5s and 20s. Now one of those
Common Lisp implementations does NOT compile to native; it compiles to
bytecode. Can you guess which one it is, by looking at the timings ?
More information about the Python-list
mailing list