>From: Biswanath Patel >Sent: Thu, May 13, 2010 11:24:05 PM > >Hi Dave, > >Thanks for the prompt reply. Yes, you are right - I meant the parser being >used in the code generated by generateDS. And yes, it has to use some > DOM API. So, there could be an additional choice to use lxml as the API apart > from the default minidom. The good thing is that you have written the > generateDS module in such a way that the code emitted by it is pretty generic > - so not much change is required in the logic itself, as I see it. The > bad thing is that the structure changes in the two kind of nodes is large. > >For example, the lxml Node API is more light-weight and has just 4 tags (no >other attributes or functions) - .tag, .text, .tail, .attrib > (http://infohost.nmt.edu/tcc/help/pubs/pylxml/etree-view.html). The structure > is simple and intuitive - children are the elements of a list and > "attributes" is a dictionary. On the other hand minidom has various types of > nodes ("ELEMENT_NODE", "TEXT_NODE") and each has some specific > functions - so there are checks required. > >As for the resource usage, I found that the approximate split in parsing (Step >1) and traversing (Step 2) is about 80:20. Speed-up for Step 1 would > be around 20-30 times even conservatively. Step 2 should also speed up by > 30-40% since the Node object created is lighter, even though the > same Python code is used (and as i mentioned in the last paragraph, the lxml > node structure is more generic). Plus memory usage by lxml is lower. > So, seems like a great thing. > >I will update you with my findings - pls get back to me with any other >questions if you start working on this. :) >
Biswanath - Thanks for the clarifications. When I start work on this, I will likely write several buildChildren methods by hand so that I can use them as a model or pattern when re-writing the code generation function in generateDS.py. I'll pass those samples along to you for your review and suggestions. And, by the way, my timing tests also show that much more time is spent in the minidom parse than in traversing the minidom DOM tree. Thanks for confirming that. I was surprised by that result, and thought there might be something wrong with my timing test. Thanks for your help and encouragement with this. I'll try to spend some time on it next week. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ------------------------------------------------------------------------------ _______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users