Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; '2.7': 0.04; 'behavior.': 0.07; 'python': 0.08; 'subject:files': 0.09; 'though:': 0.09; 'binary': 0.13; 'cc:addr:python-list': 0.15; 'thanks!': 0.15; '2.x)': 0.16; 'backported': 0.16; 'tobias': 0.16; 'bytes': 0.18; 'string,': 0.18; "doesn't": 0.23; 'wonder': 0.23; 'header:In- Reply-To:1': 0.23; 'cc:2**0': 0.25; 'unicode': 0.28; 'cc:addr:python.org': 0.29; 'seem': 0.30; '3.x': 0.30; 'str': 0.30; 'subject:number': 0.30; 'version': 0.31; 'go.': 0.32; "can't": 0.32; "i've": 0.33; 'there': 0.33; 'header:User-Agent:1': 0.33; 'causing': 0.34; 'creates': 0.34; 'file.': 0.34; 'probably': 0.34; 'towards': 0.35; "what's": 0.35; 'subject:/': 0.35; 'file': 0.36; 'but': 0.37; 'received:org': 0.37; 'open': 0.38; 'option': 0.38; 'either': 0.39; 'subject:: ': 0.39; 'data': 0.40; 'getting': 0.40; 'files': 0.40; 'more': 0.60; 'opened': 0.64; 'taking': 0.66; 'non-unicode': 0.84; 'opportunity!': 0.84; 'schrieb': 0.84; 'old,': 0.97 Date: Mon, 14 Nov 2011 20:34:31 +0100 From: Christian Heimes User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: Tobias Oberstein Subject: Re: Py2.7/FreeBSD: maximum number of open files References: <634914A010D0B943A035D226786325D42D0C264772@EXVMBX020-12.exch020.serverdata.net> <634914A010D0B943A035D226786325D42D0C2647C8@EXVMBX020-12.exch020.serverdata.net> <4EC1470B.90403@cheimes.de> <634914A010D0B943A035D226786325D42D0C26481A@EXVMBX020-12.exch020.serverdata.net> <634914A010D0B943A035D226786325D42D0C26485F@EXVMBX020-12.exch020.serverdata.net> In-Reply-To: <634914A010D0B943A035D226786325D42D0C26485F@EXVMBX020-12.exch020.serverdata.net> X-Enigmail-Version: 1.4a1pre Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1321299277 news.xs4all.nl 6881 [2001:888:2000:d::a6]:52146 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:15688 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