I'm working on a script that reveals a strange performance issue that I'm 
wondering if anyone is aware of.  My script retrieves around 1,000 
instances of Model1, and calls a method on each of those instances, with 
each method call generating an instance of Model2.

I call Model1's search method to get the 1,000-active-record list.  Here's 
the strange part: calling the instance method on the active records 
retrieve from search gives poor performance (around 1,250 seconds for my 
script); but if I create new active records using the ids of the 
search-retrieved records and calling Model1(id) on each of those ids, 
performance is much better (about 95 seconds).

The script breaks my 1,000 item list into 50-item sublists, and I get the 
described performance improvement by inserting the following line into my 
sublist-processing code:

recs = [Model1(i) for i in [i.id for i in recs]]  # recs is the sublist.

Anyone have a clue why this is happening?

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/2fbc550b-93f4-41c4-a442-47d6d09ee7c1%40googlegroups.com.

Reply via email to