Python is interpreted.... yes but it can be _fast_

I just listened to this presentation by Avery Pennarun about how Python can be very fast if you use the appropriate techniques, and how those techniques are actually graceful ones.

Here's a short summary of his points:

  • Use python modules that are implemented in C (e.g. regex)
  • threads in python are actually not good for CPU-bound calculations, since they really run in one thread underneath. but they're OK for I/O-bound operations such as reading from a hard drive.
  • If you do need to use threading for running multiple CPU-bound calculations simultaneously, you can do that in C.
  • python uses refcounting for garbage collection. this works very badly with threads. but it gives python a pretty good memory management profile overall.
  • python actually does have a garbage collector in the proper sense of it, but it is used to clear out orphaned objects with reference loops. Avoid that garbage collector at all costs. This means either breaking reference loops manually, or using "weakref" whenever possible.

Comments

Add new comment

Markdown

  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
H
P
K
5
9
h
g
N
F
1
Enter the code without spaces.