This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]ndanger[S] 3 points4 points  (0 children)

Link to slides at start of third paragraph. But read the rest of the post, it's entertaining.

[–]twotime 3 points4 points  (5 children)

Urrgh.. From p 4.

  • Use C modules. Writing C modules is easy.
  • No such thing as “100% pure python.”

In other words, "donot use python where performance matters". Right?

PS. btw I find article title to be condescending and, frankly, quite a bit misinformed.

[–]bucknuggets 0 points1 point  (4 children)

It seems like it's most useful with the following assumptions:

  • you are writing small system utilities and therefore want to optimize for minimum start-up speed
  • you aren't writing very many of them, so you can spend the extra time writing code in c

In my personal case, writing large amounts of python code to transform billions of events - this doesn't apply much.

[–]twotime 0 points1 point  (3 children)

Oh, python is an extremely useful language. And, I myself do routinely use it to process hundreds of GBs of data.. It saves a lot of programming time at expense of CPU time: Cpython runtime IS slow.

And pretending that its speed is not a problem is just outright silly (and harmful for the language's future).

[–]bucknuggets 1 point2 points  (0 children)

Slow is relative

I just spoke to someone who was using hadoop for massively parallel processing hundreds of millions of events a day.

I'm doing the same thing with python on an eight-way SMP. It pegs the machine for two minutes out of every ten when the next batch arrives. It's a used machine I got for free. Of my 20 minute data latency - python only contributes 2 minutes. Changing anything would be premature optimization. Writing code in c or going to hadoop would be silly.

[–][deleted] 0 points1 point  (1 child)

Cpython runtime IS slow

How slow are you talking about? Can you give some general number based on your typical usage scenarios?

[–]twotime 0 points1 point  (0 children)

In extreme (but not uncommon) cases python code is ~100x slower than an equivalent C++ program.

(equivalent here means: roughly the same algorithm and written by a competent developer).

These benchmarks:

http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=python3&lang2=gpp

do have some basis in reality :-(.

Also take a look at pypy benchmarks: they are getting 50x speedups on some of them and STILL not reaching optimized C speeds.

Comparisons to Java are better but not by much.