|Reported by:||(removed)||Owned by:||Adrian Holovaty|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Short version; for iteration over records, there model's init is rather unfriendly to the way the args are passed in.
At least for sqlite, the sql row is passed in as args- issue is that init shoots through self._model.fields playing with kwargs prior, doing rather costly exception catching, pulling default values, etc, then *finally* does args processing.
If you're dealing in one or two records, this doesn't show up much, but if you're dealing in 53k records (my usage is slightly weird admittedly), it's a pretty heavy slow down.
attached is a patch to refactor init, knocking around a third off the init cost via refactoring the args/kwargs processing, essentially reversing the actual flow while maintaining the same behaviour as before.
Have been using it for a few days, and passes tests; comments welcome, mainly since I need to get this integrated for my uses.