comparison src/getidblock.c @ 360:26c48ea9d896

From Jeffrey Morlan: pst_build_id_ptr reads the Block BTree into a linked list, which pst_getID does a linear scan through. For large PSTs that have millions of blocks, this is extremely slow - almost all time is spent in pst_getID. Since the BTree entries must be in order, this can be dramatically improved by reading into an array and using binary search.
author Carl Byington <carl@five-ten-sg.com>
date Wed, 06 Jul 2016 10:21:08 -0700
parents 201464dd356e
children 5c0ce43c7532
comparison
equal deleted inserted replaced
359:a3e674fade6c 360:26c48ea9d896
128 128
129 if (i_id) { 129 if (i_id) {
130 dumper(i_id); 130 dumper(i_id);
131 } 131 }
132 else { 132 else {
133 pst_index_ll *ptr = pstfile.i_head; 133 size_t i;
134 while (ptr) { 134 for (i = 0; i < pstfile.i_count; i++) {
135 dumper(ptr->i_id); 135 dumper(pstfile.i_table[i].i_id);
136 ptr = ptr->next;
137 } 136 }
138 dump_desc(pstfile.d_head, NULL); 137 dump_desc(pstfile.d_head, NULL);
139 } 138 }
140 139
141 if (pst_close(&pstfile) != 0) { 140 if (pst_close(&pstfile) != 0) {