Skip to content

Commit

Permalink
Merge pull request #1645 from davidsminor/hashCacheBump
Browse files Browse the repository at this point in the history
Reduced hash cache clear frequency
  • Loading branch information
davidsminor committed Feb 10, 2016
2 parents 29e093c + 4368554 commit fc00a71
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Gaffer/ValuePlug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,15 @@ class ValuePlug::Computation
{
if( m_threadData->computationStack.empty() )
{
if( ++(m_threadData->hashCacheClearCount) == 100 || m_threadData->clearHashCache )
if( ++(m_threadData->hashCacheClearCount) == 3200 || m_threadData->clearHashCache )
{
// Prevent unbounded growth in the hash cache
// if many computations are being performed
// without any plugs being dirtied in between,
// by clearing it after every Nth computation.
// N == 100 was chosen based on memory/performance
// analysis of a particularly heavy render process.
// N == 3200 was observed to be 6x faster than
// N == 100 for a procedural instancing scene at
// a memory cost of about 100 mb.
m_threadData->hashCache.clear();
m_threadData->hashCacheClearCount = 0;
m_threadData->clearHashCache = 0;
Expand Down

0 comments on commit fc00a71

Please sign in to comment.