Hacker News new | ask | show | jobs
by recuter 4672 days ago
http://neopythonic.blogspot.co.il/2011/06/depth-and-breadth-...

"The contrast with my visitor the next day couldn't be greater. Through a former colleague I got an introduction to Drew Houston, co-founder and CEO of the vastly successful start-up company Dropbox.

Python plays an important role in Dropbox's success: the Dropbox client, which runs on Windows, Mac and Linux (!), is written in Python. This is key to the portability: everything except the UI is cross-platform. (The UI uses a Python-ObjC bridge on Mac, and wxPython on the other platforms.) Performance has never been a problem -- understanding that a small number of critical pieces were written in C, including a custom memory allocator used for a certain type of objects whose pattern of allocation involves allocating 100,000s of them and then releasing all but a few. Before you jump in to open up the Dropbox distro and learn all about how it works, beware that the source code is not included and the bytecode is obfuscated. Drew's no fool. And he laughs at the poor competitors who are using Java."

Sometime after that, Drew poached Guido from Google. I remember this post. :)

2 comments

You can use a custom memory allocator in python? I wonder if this is somehow pluggable, or if they had to modify the interpreter.
All you need to do is set the appropriate type's tp_alloc/tp_dealloc function pointers [1] (type-specific malloc/free functions). Dropbox was having fragmentation issues from the large amount of garbage generated while scanning the filesystem, and making memory allocation use type-specific memory pools fixed it.

    [1] http://docs.python.org/2/c-api/typeobj.html#PyTypeObject.tp_alloc
The dropbox guys gave a talk about this at pycon one year but I'm having trouble finding it now. I remember thinking it involved less work than I thought it would.
According to the article, they do use a modified interpreter.
When you have to start patching the framework to handle memory allocation its probably time to move on. Just use Mono and you get your cross platform feature and obfuscation.