I'm going to assume that "fastest" refers to how fast you can get the code written:I'm just guessing at what "parse" means in this context, by the way. I'm guessing it means you want to list out all of the nodes in some order. There are several other enumerations you can choose from if you don't like post order.
posted 13 years ago
Sorry, should have been more clear. By "fast", I mean "optimized", i.e., parsing 7000 nodes is hitting my server hard for about 6 seconds. Ultimately, I'm going to need to be able to manipulate the data in multiple ways. Maybe Enumeration isn't the most optimized code for this.
Well... Paul Clapham's code is definitely the way to go if you want any sort of maintainability. Then to make it faster, you'll have to profile the code and see what it is doing in thos 6 seconds. Although 1000 iterations a second does not sound absurd, you might be able to make it faster.
The direction you are going, given your example, sounds bad. The order in which the nodes are processed will (likely) not have a major effect on performance, you still need to go through 7000 nodes.
Did you just should on me? You should read this tiny ad: