|
From: Hans B P. <ha...@di...> - 2000-09-06 23:15:06
|
> Christophe Fergeau wrote: > I just had a look at your new parser. I played a little with it and > modified two small things in parser.c : > in add_new_node, if you suppress (which is not necessary if we > are careful) > > if (seek_node (list, tmp->id)) > error (0, NULL, "Duplicate node id"); > > the parsing is faster (on my machine, when I parse dump1.txt > 32 times, it is twice as fast). If you define SPEED when > compiling, this check is ignored. Yes I agree that seek_node is not very fast, especially when the number of nodes increases! I think it would be better to find a better search algorithm though, the check for a duplicate node is important since we could lose information if a duplicate node occurs. I think it was your idea to use b-trees to improve search time. > in parse_files, when the parser processes LINK fields and > turns the strings in struct Nodelink *, it now frees the memory which > was occupied by the string No! The string was not malloc'd, so freeing it is an error. All memory allocation is done as blocks so as to minimize the calls on malloc and to better use memeory (fewer calls to malloc = lower block allocation overhead). -- Hans |