From: jurriaan <thu...@xs...> - 2005-10-05 19:01:11
|
slrn_goto_num_tagged_header calls slrn_goto_header() with the header in Num_Tag_List. ===== int slrn_goto_num_tagged_header (int *nump) /*{{{*/ { unsigned int num; num = (unsigned int) *nump; num--; if (num >= Num_Tag_List.len) return 0; if (Num_Tag_List.headers == NULL) return 0; if (-1 == slrn_goto_header (Num_Tag_List.headers[num], 0)) return 0; Slrn_Full_Screen_Update = 1; return 1; } ===== slrn_goto_header starts at the first header, and goes through all of them, finding the one that matches: ===== int slrn_goto_header (Slrn_Header_Type *header, int read_flag) /*{{{*/ { Slrn_Header_Type *h = Slrn_First_Header; while ((h != NULL) && (h != header)) h = h->real_next; if (h == NULL) return -1; Slrn_Current_Header = h; if (h->flags & HEADER_HIDDEN) slrn_uncollapse_this_thread (h, 0); _art_find_header_line_num (); if (read_flag) select_article (1); return 0; } ===== Why does slrn_goto_header go through all of them? Or at least, why doesn't slrn_goto_num_tagged_header just set Slrn_Current_Header directly? If it's in Num_Tag_List, it's an existing header and you can just select it directly, instead of (real life example here) searching through 1.5 million headers 30,000 times (I read news on a shell at my providers, then save message-id's if I want to download something. In a big binary group, these numbers are correct. Also correct is that it took more than an hour to extract these message-ids). I hope someone can explain why this searching is good - I'm not getting it, actually. If a patch is wanted, I can supply that, of course. Kind regards, Jurriaan |