Python in game development?
Kragen Sitaker
kragen at dnaco.net
Tue Aug 29 20:29:35 EDT 2000
More information about the Python-list mailing list
Tue Aug 29 20:29:35 EDT 2000
- Previous message (by thread): Python in game development?
- Next message (by thread): Python in game development?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <39781665.24F4C5B8 at prescod.net>, Paul Prescod <paul at prescod.net> wrote: >I think by now Martijn wishes he had spoken more clearly. Python is only >slow compared to assembly language and C. It is quite reasonable in >performance compared to other scripting languages!!! On 2000-04-22, I did a microbenchmark consisting of the stupid way to compute Fibonacci numbers; the Python version was as follows: #!/usr/bin/python def recfib(n): if n <= 2: return 1 else: return recfib(n-1) + recfib(n-2) print recfib(33) Here were my results, updated by more data from the next few days: These are the 'user' times from bash's 'time' command on my K6-2/450 running Linux 2.2.14 with, presumably, glibc 2.1. . . . So here's the original table, with bad entries removed and new entries extrapolated on the basis of minimal evidence: C compiled with gcc 2.95.2: 0m0.230s (see note 2) GForth 0.4.9-19990617: 0m2.360s pfe (FORTH) 0.9.14: 0m2.390s pforth V21: 0m5.340s RScheme v0.7.3.1-b39: 0m8.110s Lua 3.2: 0m9.280s GhostScript (PostScript) 5.10: 0m9.530s scm (Scheme) 5d2: 0m9.880s guile (Scheme) 1.3.4: 0m30.950s Python 1.5 (I think): 0m31.280s Perl 5.005_03: 0m44.850s gprolog: 47s (extrapolated) Klassaized Tcl 8.2: 1m11.621s hugs: 2m12s (extrapolated) pdksh v5.2.14: 7m32s (extrapolated) bash 2.03.0(1): 36m08s (extrapolated) "Klassaized" means that my Tcl code was originally a factor of six worse, and John Klassa showed me why and how to fix it. Note 2 is: (2) To be strictly apples-to-apples, we should include the compile time, too: 0m0.150s. The interesting thing about this is that Lua, whose capabilities are fairly similar to Python's, comes out ahead of all but the most sophisticated Scheme implementations and FORTH. On someone else's machine, Squeak Smalltalk came out in the same league as FORTH; I didn't have a good comparison factor and so I wasn't able to really extrapolate to my machine very well. Of course, the usual disclaimers are in order: language performance is not scalar, and this test heavily stresses function-call speed, conditional branch speed, and small-integer arithmetic speed, at the cost of ignoring essentially everything else in the language. Still, it is clear that a number of scripting languages are considerably faster than Python for some tasks: FORTH, Smalltalk, Lua, and Scheme all come out at least three times faster, and are all scripting languages by some definition. Some interpreted FORTH implementations are ten times faster. -- <kragen at pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/> Perilous to all of us are the devices of an art deeper than we ourselves possess. -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the Rings"]
- Previous message (by thread): Python in game development?
- Next message (by thread): Python in game development?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list