> > Sami> + /* Has a template symbol for this symbol been added already ? */ > Sami> + for (iterator = *(listhead); > Sami> + iterator != NULL; > Sami> + iterator = iterator->next) > > I think this means that adding template symbols is O(N^2). > A temporary hash table for recording this info would be better. > Hmm.. I can't think of an elegant way to do this. The problem is that such a hash would need to be associated with the list and the lists are have globals half member variables of context objects. A clean up getting rid of the globals and using context objects for everything would make this easier. It is a bit of a tangent but I wouldn't mind doing it if you think it is absolutely necessary. A couple of things to note is that this is only invoked for template symbols, that N here is limited by the number of variables in a scope and that strcmp is only invoked if TYPE_CODE == TYPE_CODE_TEMPLATE Revised patch attached.