Re: [Modeling-users] Fetching raw rows
Status: Abandoned
Brought to you by:
sbigaret
|
From: Sebastien B. <sbi...@us...> - 2003-07-17 23:35:22
|
Sebastien Bigaret <sbi...@us...> wrote:
> [std] 1st fetch : 7.20251297951
> [std] 2nd fetch : 1.03094005585
>=20
> [raw row] 1st fetch (ec empty): 0.618131995201
> [raw row] 2nd fetch (objects already loaded): 0.61448597908
> [raw row] 3rd fetch (objects already loaded): 2.24008309841
>=20
> [psycopg] 1st fetch: 0.038547039032
> [psycopg] 2nd fetch: 0.0789960622787
I guess I had no chance when running [std], i.e. standard
EditingContext.fetch() on 5000 objects. Here are corrected figures, average
for 5 executions:
Python2.1
---------
normal: [std] 1st fetch : 6.74
[std] 2nd fetch : 0.96
=20=20=20=20=20=20=20=20
python -O: [std] 1st fetch : 6.25
[std] 2nd fetch : 0.91
Python2.2
---------
normal: [std] 1st fetch : 5.80
[std] 2nd fetch : 0.90
=20=20=20=20=20=20=20=20
python -O: [std] 1st fetch : 5.30
[std] 2nd fetch : 0.83
By curiosity, I played ~20 minutes w/ psyco. After some tries, with the
following code on top on the script:
------------------------------------------------------------------------
from threading import _RLock
from Modeling.DatabaseContext import DatabaseContext
from Modeling.DatabaseChannel import DatabaseChannel
from Modeling.ClassDescription import classDescriptionForName
psyco.bind(DatabaseContext.initializeObject)
psyco.bind(DatabaseChannel.fetchObject)
psyco.bind(classDescriptionForName)
psyco.bind(_RLock.acquire)
psyco.bind(_RLock.release)
------------------------------------------------------------------------
I got the following figure:
Python2.1+psycho
----------------
normal: [std] 1st fetch : 5.70
[std] 2nd fetch : 0.81
python -O: [std] 1st fetch : 5.52
[std] 2nd fetch : 0.79
Python2.2+psycho
----------------
normal: [std] 1st fetch : 4.32
[std] 2nd fetch : 0.72
python -O: [std] 1st fetch : 4.21
[std] 2nd fetch : 0.68
Note on psycho: this was just tuned for fetching, and for fetching
with very simple objects, that's all. This would need further
investigation, obviously. But since I tried it, I thought I could
share, I find it amazing to be able to get a significant performance
imrpovement just a few minutes after having installed it.
That's more meat for the forthcoming 'tuning performance' section in the
guide. As a general conclusion, py2.2 is faster than py2.1, and the '-O'
option is definitively worth the try.
BTW: who is using the framework w/ python2.1 alone? And with py2.1 and
(because of) zope?
-- S=E9bastien.
|