Py2.7/FreeBSD: maximum number of open files

Christian Heimes lists at cheimes.de
Mon Nov 14 14:34:31 EST 2011


Am 14.11.2011 19:28, schrieb Tobias Oberstein:
> Thanks! This is probably the most practical option I can go.
> 
> I've just tested: the backported new IO on Python 2.7 will indeed
> open >32k files on FreeBSD. It also creates the files much faster.
> The old, non-monkey-patched version was getting slower and
> slower as more files were opened/created ..

I wonder what's causing the O(n^2) behavior. Is it the old file type or
BSD's fopen() fault?


> There seem to be slight differences though:
> 
> Non-monkey patched: I can write to the file a non-Unicode string,
> even when the file was opened non-Binary.
> 
> With monkey patch: either open the file Binary-mode, or
> write Unicode strings ..

Python 3.x doesn't collate data and text but distinguishes between bytes
(str type in Python 2.x) and unicode. You can't write unicode to a
binary file and str to a text file. See it as an opportunity! You are
taking the first step towards Python 3 compatibility. :)

Christian



More information about the Python-list mailing list