Skip to content

Commit

Permalink
Optimize random file access in GetNextFileToPrefetch().
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent 21a5ee5 commit 44c8f0c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/XrdFileCache/XrdFileCache.cc
Expand Up @@ -254,6 +254,11 @@ Cache::GetNextFileToPrefetch()
}

// std::sort(m_files.begin(), m_files.end(), myobject);

size_t l = m_files.size();
int idx = rand() % l;
File* f = m_files[idx];

std::random_shuffle(m_files.begin(), m_files.end());
File* f = m_files.back();
f->MarkPrefetch();
Expand Down

0 comments on commit 44c8f0c

Please sign in to comment.