On 6/26/14, 5:18 PM, Hans-Peter Jansen wrote: > Dear Mike, > > sorry for not coping with preferred reply behavior.. > > On Donnerstag, 26. Juni 2014 15:26:02 Mike Bayer wrote: >> On 6/26/14, 3:07 PM, Hans-Peter Jansen wrote: >>> Obviously, some operation triggers the flush method with about the >>> same consequences.. >> OK, turn off autoflush - either Session(autoflush=False), or within the >> critical block, do "with session.no_autoflush:" > Okay, that makes a difference, shaving of about 40% of total runtime, > after dealing with identical records in one session.. > > Still, attributes is highest in profiles. I guess, this is, what you > called overkill in your first response. A helper for dealing with this > situation sounds interesting, though. > > Thu Jun 26 20:41:50 2014 srelay.pstats > > 55993702 function calls (54767154 primitive calls) in 533.479 seconds > > Ordered by: internal time > List reduced from 1277 to 30 due to restriction <30> > > ncalls tottime percall cumtime percall filename:lineno(function) > 42160 292.536 0.007 292.910 0.007 > attributes.py:1321(from_collection) > 63209 39.185 0.001 39.294 0.001 attributes.py:1255(as_state) from_collection is essentially returning a structure that describes which members of a collection were removed or added. if the collection is totally empty or is unloaded, this method should be much faster. try not do to this:
enos.values.append(ev) that's what's causing that latency to occur. The one-to-many of enos->ev is mirrored by a many to one from ev->enos - set enos as a parent of ev instead, or even faster, just set the foreign key column on ev to that of the primary key of enos. > 39 39.037 1.001 39.037 1.001 {time.sleep} > 45816 30.949 0.001 30.949 0.001 {method 'query' of > '_mysql.connection' objects} > 392 30.039 0.077 30.039 0.077 {method 'recv' of > '_socket.socket' objects} > 42240 9.870 0.000 302.804 0.007 attributes.py:871(get_history) > 21083 4.284 0.000 6.500 0.000 attributes.py:868(__copy) > 42158 2.230 0.000 2.252 0.000 collections.py:711(__len__) > 21043 1.466 0.000 1.851 0.000 topological.py:51(find_cycles) > 4159430 1.369 0.000 1.369 0.000 {isinstance} > 24683 1.330 0.000 391.984 0.016 session.py:1790(flush) > 642077/24712 1.292 0.000 12.840 0.001 > visitors.py:74(_compiler_dispatch) > 197570 1.285 0.000 4.215 0.000 compiler.py:389(visit_label) > 45735 1.235 0.000 3.615 0.000 default.py:391(_init_compiled) > 246847 1.145 0.000 1.637 0.000 compiler.py:421(visit_column) > 24558 1.060 0.000 458.633 0.019 srelay.py:74(store_enos_rec) > 24636 1.048 0.000 12.709 0.001 compiler.py:1136(visit_select) > 197552 1.030 0.000 6.000 0.000 > compiler.py:1019(_label_select_column) > 24636 1.015 0.000 1.793 0.000 result.py:171(__init__) > 63126 0.939 0.000 3.202 0.000 > persistence.py:275(_collect_update_commands) > 49200/49172 0.937 0.000 3.539 0.000 db_scheme.py:91(__repr__) > 147240 0.904 0.000 1.246 0.000 > topological.py:15(sort_as_subsets) > 126514 0.814 0.000 348.487 0.003 unitofwork.py:411(execute) > 63191 0.771 0.000 1.984 0.000 > dependency.py:67(per_property_flush_actions) > 622925 0.751 0.000 0.973 0.000 attributes.py:308(__get__) > 699682 0.745 0.000 0.745 0.000 state.py:185(dict) > 189809 0.726 0.000 343.341 0.002 > unitofwork.py:177(get_attribute_history) > 73928 0.653 0.000 0.781 0.000 expression.py:3538(__init__) > 42170 0.648 0.000 0.648 0.000 {method 'clear' of 'dict' > objects} > 126252 0.639 0.000 1.795 0.000 persistence.py:802(_sort_states) > > > Cheers, > Pete > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.