merits of Lisp vs Python
Jan Dries
jan.dries at dcube-resource.be
Fri Dec 8 13:35:15 EST 2006
Alex Mizrahi wrote:
> RB> Performance claims are always controversial. So, Python is much slower
> RB> doing array multiplication, when you hand roll it, instead of using the
> RB> standard numerical packages available.
>
> heh, do you have "standard numeric packages" for everything? maybe then
> we'll make standard programs for everything -- that will obsolete "slow"
> "custom scripts" and we'll just use shell to select what program we want to
> run?
I think you're missing the point. You must know your language's
strengths and weaknesses, and use the approach/function/library that's
right for the job in the given language.
For instance, on my machine the following Python-code:
some_string = ""
while len(some_string) < 100000:
some_string += "*"
outperforms the following C-code:
strcpy(some_string,"");
while(strlen(some_string) < 100000)
strcat(some_string,"*");
by roughly *factor 15*!
The point of course is you shouldn't be using strlen/strcat this way,
nor use this piece of code as a reference for benchmarking C versus
Python performance.
And for the same reason: in the presence of excellent optimized Python
libraries for matrix multiplication, you probably shouldn't be doing
that in pure Python if performance matters, nor use that as a reference
case in benchmarking Python.
Regards,
Jan
More information about the Python-list
mailing list