vinay basavanal wrote:I have written some code which will fetch contents from a resource which is actually stored in a tree format. Since it is in a tree format, there will be a parent-child relation and hence recursion.
I am facing lot of performance issue as tree is growing in size this particular piece of code takes up-to 25 sec which is very bad. This piece of code will basically read data stored in file system (just for example) each content has certain set of property which it has to read.
Well, I can't be absolutely sure, but that seems to be an awful lot of procedure to convert something that, presumably, is already in a pseudo-tree format.
My suggestion:
StopCoding (←click) and
write down exactly how this mapping is supposed to work (ie, what you're trying to do).
I think, if it was me, I'd also make my Links class more atomic; perhaps something like:
which would allow you to build up each link incrementally.
I also worry a bit that the link doesn't contain a value other than its name (unless the name
is the value). In general, node structures are used to store
values in tree form and so generally have the form
Node<T> (where T is the type of value stored), whereas all your class seems to do is store other nodes.
But it's quite possible I'm missing something.
Winston