Skip to content
Snippets Groups Projects
Commit 109dd53c authored by Aaron's avatar Aaron
Browse files

Prefer list over vector chromsweep's cache. Huge performance increases

when the database (-b) file has many more intervals than the query file.
Thanks to Neil Kindlon (Quinlan Lab)."
parent 76209a3d
No related branches found
No related tags found
No related merge requests found
......@@ -32,8 +32,7 @@ ChromSweep::ChromSweep(BedFile *query, BedFile *db,
, _reciprocal(reciprocal)
{
_hits.reserve(100000);
_cache.reserve(100000);
_query->Open();
if (printHeader) _query->PrintHeader();
_db->Open();
......@@ -48,8 +47,7 @@ ChromSweep::ChromSweep(BedFile *query, BedFile *db,
ChromSweep::ChromSweep(string &queryFile, string &dbFile)
{
_hits.reserve(100000);
_cache.reserve(100000);
_query = new BedFile(queryFile);
_db = new BedFile(dbFile);
......@@ -69,7 +67,7 @@ ChromSweep::~ChromSweep(void) {
void ChromSweep::ScanCache() {
vector<BED>::iterator c = _cache.begin();
list<BED>::iterator c = _cache.begin();
while (c != _cache.end())
{
......
......@@ -64,8 +64,12 @@ private:
float _overlapFraction;
// do we care about strandedness.
bool _sameStrand, _diffStrand, _reciprocal;
// a cache of still active features from the database file
vector<BED> _cache;
// a cache of still active features from the database file\
// 2012-Oct-29: prefer LIST over VECTOR as, when _cache is large,
// the overhead of deleting from a vector is huge. Deleting from
// the front of a LIST is cheap. Thanks to Neil Kindlon (Quinlan lab)
// for the very important fix.
list<BED> _cache;
// the set of hits in the database for the current query
vector<BED> _hits;
// a queue from which we retrieve overlap results. used by Next()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment