c7e67fd81bebb4535b83916642279a71852ad582 angie Fri Aug 16 15:25:38 2013 -0700 Speedup for twoBitIsSequence: look up name in tbf->hash instead of scanning indexList. diff --git src/lib/twoBit.c src/lib/twoBit.c index d8ba582..05d0986 100644 --- src/lib/twoBit.c +++ src/lib/twoBit.c @@ -1216,24 +1216,17 @@ /* return the size of the all the sequence in file, not counting N's*/ { struct twoBitIndex *index; long long totalSize = 0; for (index = tbf->indexList; index != NULL; index = index->next) { int size = twoBitSeqSizeNoNs(tbf, index->name); totalSize += size; } return totalSize; } boolean twoBitIsSequence(struct twoBitFile *tbf, char *chromName) /* Return TRUE if chromName is in 2bit file. */ { -struct twoBitIndex *index; - -for (index = tbf->indexList; index != NULL; index = index->next) - { - if (sameString(index->name, chromName)) - return TRUE; - } -return FALSE; +return (hashFindVal(tbf->hash, chromName) != NULL); }