I suspect that you are writing on the database after/during each call to
the instance method and you are accessing some Function field.
If it is the case, here is what could happen. At the first call Tryton
will compute the Function fields for the all 1000 records. Then if you
call write/create (or save) the local cache will be cleared. And so on
the next call to the method, Tryton will compute again the Function
fields for the 999 records and so on.
So it is always better to create/write at the end of the computation if
possible or by batch of cache_size().
And this can also explain why by instantiating record individually the
record, you have better performance because in this case the local cache
is only computed for 1 instance.
--
Cédric Krier - B2CK SPRL
Email/Jabber:
cedric...@b2ck.com
Tel:
+32 472 54 46 59
Website:
http://www.b2ck.com/