Re: [Modeling-users] ec.insert() timing
Status: Abandoned
Brought to you by:
sbigaret
|
From: Yannick G. <yan...@sa...> - 2003-09-11 13:44:46
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On September 11, 2003 07:08 am, you wrote:
> Maybe sys.stderr is buffered, which may explain why you do not see the
> "c\n" after insert, and why you do not notice any pause for
> saveChanges() (which is very strange). Do you experience the same thing
> with sys.stderr.flush() after write()?
Unlike stdout, stderr should not but buffered but it's easy to try and
most bugs lies in false assumptions:
for i in range(100):
sys.stderr.write("%d\n" % i)
newRec = self._dbClass()
sys.stderr.write("a\n")
sys.stderr.flush()
for key, value in self._defaults.items():
newRec.takeValueForKey(value, key)
sys.stderr.write("b\n")
sys.stderr.flush()
self._ec.insert(newRec)
sys.stderr.write("c\n")
sys.stderr.flush()
self._ec.saveChanges()
sys.stderr.write("d\n")
sys.stderr.flush()
Same result : \
> Last, you probably know this already, but just in case: if you insert()
> a bunch of objects in a batch, you'd probably want to saveChanges()
> after having inserted every objects.
Yes, I just made the loop for benchmark purpose. I usually insert
items one by one.
> Reassure me: when you say that <<The 100 record insert takes a few
> minutes>>, that's under profiling, isn't it?
Yes, the time I gave is under profiling:
>>> beg=time(); resp = insert(); end=time()
>>> print "%.2f s." % (end-beg)
230.03 s.
But the non-profiled time is still a few minutes:
>>> beg=time(); resp = insert(); end=time()
>>> print "%.2f s." % (end-beg)
212.44 s.
Without profiling, CPU usage stays under 20%, thats why I think about
a lock synchronization problem. I can't recall when this started
because I usually insert an item at a time but I'm pretty sure that it
have not alway been like this. I'll try to downgrade my Modeling
version and to load an old model with less entities.
Stay tuned !
- --
Yannick Gingras
Byte Gardener, Savoir-faire Linux inc.
http://www.savoirfairelinux.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE/YHpyrhy5Fqn/MRARAvuzAJ9wD4Z23r8bLL1KDnDeN4xLy5gOAQCeLJe+
5uWG7Mbs6Xs/0TbUviw65KI=
=OqlV
-----END PGP SIGNATURE-----
|