Python vs. Perl, which is better to learn?

James J. Besemer jb at cascade-sys.com
Tue May 7 03:02:08 EDT 2002


Peter Hansen wrote:

> Patrick W wrote:
> >
> > I *was* thinking that there are many situations in which Python is too slow ...
>
> "Many"?  Like what?

> I object to that characterization: in two years
> of extensive Python use in a very wide variety of areas, I have not
> yet found Python to be "too slow".  I believe this is a common myth
> or nasty rumor, without strong basis in reality.

A lot of real-world applications require performance approximating the underlying CPU
speeds, in which case Python would be simply unable to do the job.  E.g., I once had
a contract with HP working on their printers.  I was working on a "test bed" which
meant all prototype hardware and software so we could pick any language we wanted.
The primary application meant reading color image data out of a file and then
performing an exceedingly complex series of transformation of the data into the
bitmaps for the several layers of ink to be laid down.  E.g., the placement of each
color bitmap typically has to be shifted vertically and horizontally to compensate
for mis-alignment of the print heads.  At 30 inches per second, times 600 ink nozzles
times 2400 dots per inch and you're talking a lot of bits to sling.  If the bits
aren't ready on time then the ink is applied in the wrong spot, resulting in an
intolerable error.

There are other real-world applications where the hardware is too cramped for a
language as "cushy" as Python.  One example is the production runtime environment for
HP printers.  It's pretty harsh and constrained.  They don't have floating point and
have even harsher real-time budgets.  A further example is the millions of extremely
tiny CPUs being deployed.  E.g., one project had a CPU that lived in a hand-held
probe.  It had to process thousands of temperature readings per second and apply a
complex transformation to the data.  In both cases, the additional overhead of a
language like Python would be completely intolorable.

For less time critical applications, like serving up CGI or preparing reports or
other sys admin functions, Python surely is plenty fast enough.  But it's wrong to
extrapolate your limited experience in that domain to all or "many" other situations.

If I may offer a personal observation: It kills me when someone's strongest argument
that something simply cannot be is that he "hasn't seen" or "can't think of" any
contradictory data.  Just because you can't THINK of it is usually NO grounds to
object.

Regards

--jb

--
James J. Besemer  503-280-0838 voice
http://cascade-sys.com  503-280-0375 fax
mailto:jb at cascade-sys.com







More information about the Python-list mailing list