[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

RE: Re: [pygame] Python and Speed



> -----Original Message-----
> From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx] On
> Behalf Of Nathan Whitehead
> Sent: Friday, April 18, 2008 11:24 AM
> To: pygame-users@xxxxxxxx
> Subject: Re: Re: [pygame] Python and Speed
> 
> On Fri, Apr 18, 2008 at 9:23 AM, Ian Mallett <geometrian@xxxxxxxxx> wrote:
> > OK, my point here is that if C languages can do it, Python should be
> able to
> > too.  I think all of this answers my question about why it isn't...
> 
> You don't have to use C to get fast programs.  OCaml is very fast
> (between C and C++), especially when you start doing interesting
> things.  It comes with an interpreter, a bytecompiler, and an
> optimizing compiler.  Also, there is OCamlSDL, which is the pygame of
> the OCaml world.  http://ocamlsdl.sourceforge.net/
> 
> It takes a little bit of brainbending to wrap your mind around the
> OCaml language, but once you figure it out you can write real programs
> quickly, and have them be very optimized.
> 
> I prefer hacking around with pygame and python because you get so much
> flexibility.  You don't have to declare variables, you just use them.
> You don't have to muck around with makefiles.  You can mix different
> types of data in dictionaries.  It is just easier, but the price you
> pay is performance.  In a typed language like OCaml, the compiler
> might know that every entry in a dictionary is an integer so it can
> optimize every access.  In python, the interpreter has no idea what
> will come out when you request a key, it could be an integer, a sprite
> object, None, ...  The programming languages community is working
> feverishly to combine the benefits of typed languages with the ease of
> use of dynamic languages, but it is an ongoing effort.
> --
> Nathan Whitehead

If you're going to start recommending alternate languages, really, let's
just throw out a link to the computer language shootout:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all

If python isn't working out for you performance wise, sort by speed and head
down the list until you find one you like. Programming langauges are tools,
pick the right one for the job.
---------
John Krukoff
helot@xxxxxxxxxxx