On Fri, Jan 7, 2011 at 9:45 AM, Cal Leeming [Simplicity Media Ltd]
<[email protected]> wrote:
> Do you have any performance comparisons? Would be interested to see them.
> Cheers
> Cal
These tests were all done using an in-memory SQLite database:
Lots of inserts using dse:
dex = dse.ModelDelayedExecutor(foo)
for i in range(0, 5000):
dex.addItem({'name': 'Person%s' % i, 'age': i})
dex.close()
Takes about 0.107000112534 seconds.
Same thing, using the orm:
for i in range(0, 5000):
foo(name = 'Person%s' % i, age = i).save()
Takes 0.990000009537 seconds. Not that big difference.
But if you want to update a bunch of records, for instance to change a
calculated value ( I`m not doing that here, just changing the name ):
dex = dse.ModelDelayedExecutor(foo)
try:
for item in dex.getItems():
item['name'] = "%s Doe" % item['name']
dex.addItem(item)
finally:
dex.close()
It takes 0.12299990654 seconds. Using orm:
for item in foo.objects.all():
item.name = "%s Doe" % item.name
item.save()
it takes 9.60100007057 seconds. It shows that the overhead of using
the orm is significant ( we all knew that allready ).
Regards,
Thomas
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.