Russ, great comments. Yes, I'm speaking execution time, and I have a feeling you're right. Premature optimization happens to be a problem of mine (One that my girlfriend wishes I could correct... oh, wait,nevermind).
I think this was just one of those sanity-check questions, sending out a feeler to see if anyone has tried this or says "WAIT You Idiot, don't do that!" Good to know that django uses the standard SAX (although I don't know why I thought they wouldn't). I suppose lxml could be faster, but I'm currently hosting on webfaction shared and it looks like it's a pain to get lxml running there. I'll try some timings and report back on what I find (if anything). Thanks everybody! Taylor On Jan 26, 6:01 pm, Russell Keith-Magee <[email protected]> wrote: > On Tue, Jan 27, 2009 at 12:35 AM, Taylor <[email protected]> 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 [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 -~----------~----~----~----~------~----~------~--~---

