why python is slower than java?

Alex Martelli aleaxit at yahoo.com
Sun Nov 7 04:22:03 EST 2004


Maurice LING <mauriceling at acm.org> wrote:
   ...
> 1. I've asked a question which I may be wrong (many people do that)

So how would you react if somebody asked a question that _takes for
granted_ something that you strongly believe is not the case, to the
point of absurdity?  Say somebody posted to a local NG or mailing list
about Melbourne nightlife, asking for explanations of why the bands
playing in Melbourne clubs are so much worse than those playing in
Canberra ones.  No justification of the assertion, as if it was so
obvious it didn't need any, just a request for an explanation.  And say
later the same guy clarified the claim by stating, again without ANY
supporting data, that his criterion is based on bands' records and how
well they place in the hit parades -- and again, not asking _whether_
Melbourne's scene is inferior by that measure, not even stating _that_
it is and inviting rebuttal, but still expressing himself as if this was
so EVIDENTLY the case that an explanation of WHY was all he needed.

To make you more personally involved in the issue, imagine that you had
spent lots of time and energy convincing friends and acquaintances to
move to Melbourne, rather to Canberra, based in some part on how much
better the club music scene is in Melbourne.  And you even had some
little involvement in the past in trying to arrange for some Melbourne
clubs to get in contact with some hitparade-successful bands.

Now, even if you personally care little about hit parades, it seems
sensible for you to review the bidding -- if nothing else, to be able to
qualify future advice to other friends, or, if needed, try to help clubs
and bands get in touch again.

And you can't find *ANY* support for the unquestioned-assumptions, "so
obvious they only need explanation", behind that guy's questions.  As
far as you can tell, Melbourne's clubs have about FOUR times more bands
that place high on the hit parade playing on typical nights than
Canberra clubs do.

So, would you be quiet and let Melbourne's reputation get sullied when
you believe to have data to show that?  Or would you rather relate your
own observations, and challenge the original poster to come out and
*GIVE* those data he was basing his "too obvious to question" underlying
assumptions?!


> 2. Some had answered and pointed out my misconceptions, thank you all
> for that.

Does this imply you now believe that the unquestioned-assumptions behind
your "why" questions were unfounded?

> 3. Some had pointed to the fact that I am from University of Melbourne
> (with unknown motives). It was then clarified that I was an honours 
> student (www.zoology.unimelb.edu.au) in the Dept of Zoology. Perhaps I
> may say that I am a molecular biologist by degree.

I have no idea about [3].  One of my best friends in Australia is in
Melbourne now (Canberra previously).  I do occasionally hear snide jabs
at Melbourne, but those are generally from _Sidney_ people, so I tend to
discount them appropriately;-).

As for your professional specialization, how would it make you feel and
react if somebody posted a question such as, say, "why are the
nucleotides in cats' cells so different from those in dogs'?".  Not a
good parallel, I guess, because in this case the total and utter
cluelessness of the asker and absurdity of the question are entirely
obvious -- you would not need any research to confirm that, nor would
you need to fear anybody else getting misled from this question.  So
please find something slightly subtler, but just as wrong, and focus on
a poster taking the wrong underlying assumption so much for granted that
they only need to ask about WHY things are (obviously, w/o any need for
discussion or confirmation) that way...


> 4. Some had pointed out instances (books and all) whereby my wrong 
> impressions might have been formed.

Forming a wrong impression is always a possibility.  It's proceeding to
take it for granted as an obvious fact, that is quite questionable.  If
you had phrased your observation in terms such as "I have gotten the
impression, without having done any measurement myself, that" etc, the
reactions would have been vastly different; your choice to express
yourself by implying an unquestionable fact existed and only required
explanations of its reasons, is a good part of the reaction's cause.

> 5. Some had painfully taxed on the my initial misconceptions and 
> generalizing it to the ridicule of non-experts, and in the process of
> so, suggesting controversial codes in the pre-text of eliciting responses.

Well I _did_ get responses, which easily led to Python and Java programs
that are strongly equivalent (same buffer sizes, and all), with a 4:1
performance advantage for Python (perhaps explainable by Java's terrible
startup/shutdown performance, with 4:1 ratio of pagefaults to Python's;
pagefaults, of course, _can_ be seen as disk-intensive, too;-).

> 6. Furthering it, using notable words from famous people, to 
> discriminate against a group of people, when the first instance had been
> breached... you can choose not to reply.

Just like you could choose to stay silent, and let some assertions and
implications against the Melbourne club scene stand unchallenged when
you believe you can show those "stated as too obvious to discuss"
implications are totally wrong, ill-founded, and reverse of the truth.

If you let the untruth stand unchallenged, quite apart from the sympathy
for truth that many of us feel, you'd badly serve anybody who,
considering a move to Melbourne in the near future, might "do their
homework", research recent Melbourne/Canberra comparisons, and find that
apparently nobody questions with any real data the "too obvious to
discuss" assumption about bands playing in clubs.  Plus, you'd waste the
effort that weirdly implied assumption prompted you to, in order to
start researching the issue a bit.

If you do post what you have, you serve well anybody who's looking up
the issue in the future, AND get a chance to see what solid data the
original poster based their taken-for-granted assumptions on -- IF ANY.


> All these happens when the discussion had been taken to other areas... I
> brings one to wonder on maturity and character......

_ALL_?  Re [5], I'm still trying to get a good benchmark going -- I
expect to observe roughly 1:1 ratio (net of startup and shutdown) when
that's the case.  Why is that "other areas" wrt your original question
of WHY (things were obviously, undisputably in a state they aren't)?

Are you claiming that, if one asks "why is the sky yellow?", striving to
show him and everybody else that it *ISN'T* is "taking to other areas"
the discussion?!  I entirely disagree.  Phrasing the original question
as a "why" was one issue surely deserving of metadiscussion, but I find
it perfectly appropriate (and a sign of impeccable character and
maturity) to rephrase the question to a better "is it the case that" and
trying to explore that in this enhanced form; including explanations of
one's observations in the matter (e.g., the one about the 4:1 pagefault
ratio that's clearly part of the slowdown of Java wrt Python here).


> All the knowledge in this world are in libraries and now, networked 

False: not all knowledge in the world can be usefully embodied in print
(text, images, even videos and sound recordings actualy).  An important
part of human knowledge is experiential, and only a shadow of that
important part can be captured in libraries, including multimedia ones.

> libraries via internet. Today, almost all high school students in 
> developed countries are versed in internet. And by your argument, it 
> seems that all universities are complete waste of money as all knowledge
> is out there and the tools to access the knowledge is readily available.

Many universities, as a part of their mission, conduct research and
therefore presumably generate new knowledge.  This entirely self-evident
and obvious fact, even by itself, makes your assertion doubly absurd:
"all knowledge is out there" readily implies there is no knowledge to be
added, and "all universities are complete waste of money" similarly
implies no university is generating new knowledge, or what they do
generate is utterly worthless.

Your assertion that "by my argument" (which had never touched anywhere
upon the research role of universities) research is nonexistent, futile,
or entirely worthless, is at the same time absurd and deeply insulting.
If and when I want to criticize university research, I will do so
myself, and I do not AT ALL appreciate this attempt to put words in my
mouth, even though any reader with a 3-digits IQ can see it as the
insulting absurdity it is.

If we stick to the _teaching_ role of universities, the reasons my
arguments imply nothing like you're stating are both more interesting
and subtler.  On one hand, there is the experiential side of knowledge.
By conducting experiments in a laboratory under proper guidance, even
though those experiments are not novel, students acquire knowledge
experientially -- a very different learning mechanism from reading books
and articles, or listening to lectures.  Of course, good high schools
have laboratories etc, too, but in University, at least in scientific
and technical disciplines, the experiential learning process _should_
blossom to a far higher degree (if it doesn't -- if a university skimps
on labs and overwhelms students with just books and lectures -- then
that may well be a valid ground for criticism, _of that particular
university's choice in didactics_, of course, not "of all
universities").  In other disciplines, experiential learning may be less
obvious, but if the university is any good, it will be there.

And then, there is the issue of selection and structuring.  I have
posted about that recently, in a thread asking whether there was a book
about large-scale software development with Python, and you can easily
look it up on google groups.  To summarize: I have lots of materials on
the subject.  I find I'm easily able to organize these materials into
courses and workshops that are specifically aimed at an identified group
of students, with certain backgrounds and interests.  Organizing the
same material into a _book_ is a far harder task, one which I can't take
the time off to undertake at present... which ties back to a _part_ of
the reason why not all knowledge is in books or other printed or
otherwise 'frozen' (recorded, filmed, ...) forms.  A vast majority of
the materials I collected IS out there -- over the years, I've posted a
goodly fraction of it.  But it's generally unselected and unstructured,
making the learning task far more daunting than proper structuring and
selection can potentially make it.

A good university course has selection and structuring, and is
interactive in a way a book can never be, thus potentially making the
s&s more appropriate and effective for the specific individual students
who are taking that course wrt books (or some other well-organized
subset of info from the net).  Of course, if you throw 500 students at a
poor professor, no matter how good he is, his ability to teach a really
good course will be impaired -- smaller classes are MUCH better that way
(another valid criticism of the way many universities are structured).

Usenet does have the interactivity advantage, but normally not the
structuring one, with rare exceptions, and only to some extent the
selection one.  Thus, it can complement rather than substitute for
books, courses, and information search on the raw net.  It has little
experiential value, though not zero -- _some_ of the interaction on it
does work to stimulate and vaguely guide/aim some experiences.


> As mentioned, the discussion is heading else where and my misconceptions
> cleared before your replies. If I've indeed forgotten, my sincere 
> apologies and hereby thank you for your time and efforts.

Thanks, this is appreciated.  I take it then that you do not any longer
opine that on disk-I/O intensive programs Python is self-evidently
slower than Java?

> You still have the right to remain solemn.

Heh, nice.  Well, it's a right I surely exercise far more often than the
more traditional one of remaining silent;-).


Alex



More information about the Python-list mailing list