Hi all, On Sunday 23 September 2012 15:05:21 Anssi Kääriäinen wrote: > > Doing final polish for Ian's patch and providing benchmark results for it > will get this patch closer to commit. >
I made some initial benchmarks, and they do not reflect the change I've seen in
the actual application. I don't yet know what to make of this. With this
model:
class AllSorts(models.Model):
start = models.IntegerField()
square = models.IntegerField()
sqrt = models.FloatField()
cubicroot = models.DecimalField(decimal_places=20, max_digits=25)
name = models.CharField(max_length=100)
slug = models.SlugField()
Calling this function for fetching:
@transaction.commit_on_success
def getAllSorts():
errors = 0
print "Getting %d objects" % AllSorts.objects.all().count()
for alls in AllSorts.objects.all():
if alls.cubicroot.is_nan():
errors+=1
print "Got %d errors in the decimal" % errors
I made 10,000 records. Getting them all (and making sure the decimal did not
return a NaN) takes ~1.95 seconds on the old code, ~1.75 seconds on the new
code, and ~1.6 seconds on the new-new code (where we use a new float_is_enough
option, which tells the backend to only use Decimals for DecimalFields).
Adding a calculated expression:
@transaction.commit_on_success
def getAllSorts():
errors = 0
print "Getting %d objects" % AllSorts.objects.all().count()
for alls in \
AllSorts.objects.all().extra(select={'e':'"START"+(2*"CUBICROOT")'}):
if alls.cubicroot.is_nan():
errors+=1
print "Got %d errors in the decimal" % errors
Did not change the results significantly, despite my expectations.
I'm not sure yet what we did in the application that made this make a huge
difference. I see a significant difference here, but not amazing (though ~20%
is
nothing to scoff at). Perhaps making more request of fewer rows, counter-
intuitively makes more of a difference. Perhaps more strings. But I know I saw
a much bigger difference than this.
The new-new code (sans documentation, at this point) is available for your
review and benchmarking as Pull Request 402, or the oracle-float-exprs branch
in my fork. The benchmarking project is attached to this message.
Thanks for your attention,
Shai.
--
You received this message because you are subscribed to the Google Groups
"Django developers" 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-developers?hl=en.
bench.tgz
Description: application/compressed-tar
