On Tue, Jan 27, 2009 at 12:35 AM, Taylor <trfl...@gmail.com> wrote: > > Okay, that makes sense. Thanks for the link to Python timing! > > Can anyone familiar with the internals of django's serialization and > templating offer any suggestions?
My suggestion is this: Try it. I can't say I've ever done a comparative performance analysis of the template system vs the XML serializer myself, and I can't think of any example I've seen in the blogisphere, either, so the best you can do is try it yourself and see what you find. Here are a few general comments that might help: Django's XML serializer is really just a light wrapper over the Python SAX XMLGenerator. The only difference is that the serialization format is essentially fixed. If you roll your own XML serializer, you'll have to go through essentially the same boilerplate code to traverse the Django model structure, but you will be able to specify your own XML schema. The Python standard library contains several ways to generate XML. The SAX libraries are fairly easy to use, but they may not be the fastest option. If you use the template system, you won't get any guarantees about XML well-formedness - my crystal ball predicts that this will become the black hole where bugs lie in this technique. Another thing to consider - when you say "fastest", do you mean development time or execution time? Your existing level of expertise with XML APIs and the Django template framework will effect development time. Lastly - are you getting hung up on a performance analysis that really doesn't matter? If you're going to be serializing gigabytes of data, then it might matter, but if you will be pushing out a 20 line XML file once a minute, the difference between native XML generation and template generation could almost be reduced to a rounding error. Make sure you're not getting into premature optimization. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---