nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Performance auf MacOS X

Von: Volker Birk (bumens@dingens.org) [Profil]
Datum: 16.07.2009 22:57
Message-ID: <h3o47fU3o6L1@news.in-ulm.de>
Newsgroup: de.comp.lang.python
Hallo,

zumindest Python 2 verhält sich auf MacOS sehr seltsam:

vb@bayhorse:~ % time printf 'class X: pass\nx = [X() for i in range(100000)]\n' |python2.6
printf 'class X: pass\nx = [X() for i in range(100000)]\n'  0,00s user 0,00s system 37%
cpu 0,003 total
python2.6  0,20s user 0,04s system 99% cpu 0,244 total
vb@bayhorse:~ % time printf 'class X: pass\nx = [X() for i in range(1000000)]\n'
|python2.6
printf 'class X: pass\nx = [X() for i in range(1000000)]\n'  0,00s user 0,00s system 38%
cpu 0,003 total
python2.6  5,46s user 0,31s system 99% cpu 5,813 total

Unter Windows jedoch braucht das Anlegen einer Liste von 1 Mio. Objekten
wirklich in etwa zehn Mal so lange wie das Anlegen einer Liste von
hunderttausend Objekten.

vb@bayhorse:~ % uname -a
Darwin bayhorse.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31
22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386
vb@bayhorse:~ % python2.6 --version
Python 2.6.2

Bei 3.0 ist das nicht mehr so:

vb@bayhorse:~ % time printf 'class X: pass\nx = [X() for i in range(100000)]\n' |python3.0
printf 'class X: pass\nx = [X() for i in range(100000)]\n'  0,00s user 0,00s system 38%
cpu 0,003 total
python3.0  0,13s user 0,08s system 17% cpu 1,193 total
vb@bayhorse:~ % time printf 'class X: pass\nx = [X() for i in range(1000000)]\n'
|python3.0
printf 'class X: pass\nx = [X() for i in range(1000000)]\n'  0,00s user 0,00s system 38%
cpu 0,003 total
python3.0  1,20s user 0,08s system 99% cpu 1,287 total
vb@bayhorse:~ %

Gibt's von der 2.6 noch eine gepatchte Version?

Viele Grüsse,
VB.
--
"Wahlkampf mit Steinmeier als Kanzlerkandidat -
das ist so als ob ein Eunuch ins Puff geht."

Monika Gruber

[ Auf dieses Posting antworten ]

Antworten