these two stack traces appear to show completely different operations proceeding (in one its a flush with a delete occuring, the other its performing an INSERT or UPDATE).
my vague understanding of psyco is that it can be quite arbitrary as to what kind of code it can improve and what kinds it cannot. Therefore SA can never really make any "guarantee" of psyco working exactly the same way across releases. There has been very little changed as far as the flush() procedure across 0.4.4 and 0.4.5, except for some cascade fixes regarding orphans (detailed in CHANGES). I would first take a look at the SQL being issued as the first source of speed differences; if in 0.4.5 there's suddenly a whole series of deletes occuring which do not within 0.4.4, then that's the source of the difference. On Jun 10, 2008, at 1:09 PM, Artur Siekielski wrote: > > Hi. > > I'm using Python 2.5.1 + SQLAlchemy + Psyco 1.6 for accelerating > Python computations. Everything works ok for SQLAchemy 0.4.4 (50% > performance boost), but for SQLAlchemy 0.4.5, 0.4.6 and latest SVN > version (0_4 branch) there is a huge slowdown and profiling shows that > SA's code takes much time: > > ncalls tottime percall cumtime percall > filename:lineno(function) > 1 0.000 0.000 98.840 98.840 <string>:1(<module>) > 1 0.001 0.001 98.840 98.840 {execfile} > 1 0.052 0.052 98.837 98.837 model/bin/run_dbwork.py: > 4(<module>) > 1479 1.944 0.001 88.724 0.060 /home/users/artur/md/ > system/trunk/model/... (_yieldData) > 4202 84.182 0.020 85.126 0.020 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/sql/util.py: > 7(sort_tables) > 2106 2.446 0.001 46.555 0.022 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/mapper.py: > 979(_save_obj) > 2096 0.133 0.000 42.690 0.020 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/mapper.py: > 1226(_delete_obj) > 1647 0.303 0.000 9.767 0.006 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/scoping.py: > 97(do) > 160637 1.331 0.000 3.048 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/unitofwork.py: > 605(collection) > 17172 0.742 0.000 2.501 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/unitofwork.py: > 859(preexecute) > 145072 0.992 0.000 1.471 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/unitofwork.py: > 521(polymorphic_tasks) > 1478 0.012 0.000 1.157 0.001 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/session.py: > 944(_cascade_save_or_update) > 1478 0.027 0.000 1.145 0.001 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/session.py: > 1236(_cascade_iterator) > 1478 0.319 0.000 1.123 0.001 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/sql/compiler.py: > 625(_get_colparams) > 1478 0.497 0.000 1.115 0.001 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/mapper.py: > 1309(cascade_iterator) > 13302 0.588 0.000 0.689 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/sql/compiler.py: > 631(create_bind_param) > 8868 0.360 0.000 0.494 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/properties.py: > 438(cascade_iterator) > 1508 0.083 0.000 0.487 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.6-py2.5.egg/sqlalchemy/orm/query.py: > 945(iterate_instances) > > > For comparison here is profile stats dump for the same data processed > using SA 0.4.4: > > ncalls tottime percall cumtime percall > filename:lineno(function) > 1 0.000 0.000 15.430 15.430 <string>:1(<module>) > 1 0.001 0.001 15.430 15.430 {execfile} > 1 0.050 0.050 15.427 15.427 model/bin/run_dbwork.py: > 4(<module>) > 1469 1.827 0.001 13.058 0.009 /home/users/artur/md/ > system/trunk/model/... (_yieldData) > 2080 2.438 0.001 5.351 0.003 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/orm/mapper.py: > 914(_save_obj) > 159041 1.253 0.000 2.938 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/orm/unitofwork.py: > 620(collection) > 4147 0.412 0.000 2.779 0.001 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/sql/util.py: > 7(sort_tables) > 16960 0.726 0.000 2.428 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/orm/unitofwork.py: > 874(preexecute) > 4288 1.418 0.000 2.347 0.001 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/sql/visitors.py: > 50(traverse) > 1635 0.292 0.000 1.996 0.001 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/orm/scoping.py: > 97(do) > 2067 0.097 0.000 1.478 0.001 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/orm/mapper.py: > 1152(_delete_obj) > 143262 0.971 0.000 1.442 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/orm/unitofwork.py: > 531(polymorphic_tasks) > 1468 0.309 0.000 1.090 0.001 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/sql/compiler.py: > 653(_get_colparams) > 1468 0.015 0.000 0.697 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/orm/session.py: > 922(_cascade_save_or_update) > 1468 0.023 0.000 0.682 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/orm/session.py: > 1208(_cascade_iterator) > 13212 0.564 0.000 0.664 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/sql/compiler.py: > 659(create_bind_param) > 1468 0.155 0.000 0.656 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/orm/mapper.py: > 1235(cascade_iterator) > 8808 0.339 0.000 0.472 0.000 /usr/share/python2.5/ > site-packages/SQLAlchemy-0.4.4-py2.5.egg/sqlalchemy/orm/properties.py: > 428(cascade_iterator) > > > I have also experienced strange errors with 0.4.6, like calling > Python's property "set" method by SA code with argument of type > MapperProperty. > Any chances to use SQLAlchemy > 0.4.4 and Psyco? > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---