From: Christopher L. Conway Date: Thu, 15 Apr 2010 16:56:06 +0000 (+0000) Subject: Moving debug output in ~ContextObj under a conditional. Should fix most of the slowdo... X-Git-Tag: cvc5-1.0.0~9115 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32d227bc04096ddd3bc09bdaab194c5cb430af6a;p=cvc5.git Moving debug output in ~ContextObj under a conditional. Should fix most of the slowdown from r413. --- diff --git a/src/context/context.cpp b/src/context/context.cpp index d371dc39a..ca6564cf5 100644 --- a/src/context/context.cpp +++ b/src/context/context.cpp @@ -227,9 +227,13 @@ ContextObj* ContextObj::restoreAndContinue() throw(AssertionException) { void ContextObj::destroy() throw(AssertionException) { - Debug("context") << "before destroy " << this - << " (level " << getLevel() << "):" << std::endl - << *getContext() << std::endl; + if( Debug.isOn("context") ) { + /* Context can be big and complicated, so we only want to process this output + * if we're really going to use it. (Same goes below.) + */ + Debug("context") << "before destroy " << this << " (level " << getLevel() + << "):" << std::endl << *getContext() << std::endl; + } for(;;) { // If valgrind reports invalid writes on the next few lines, // here's a hint: make sure all classes derived from ContextObj in @@ -242,14 +246,18 @@ void ContextObj::destroy() throw(AssertionException) { if(d_pContextObjRestore == NULL) { break; } - Debug("context") << "in destroy " << this << ", restore object is " - << d_pContextObjRestore << " at level " - << d_pContextObjRestore->getLevel() << ":" << std::endl - << *getContext() << std::endl; + if( Debug.isOn("context") ) { + Debug("context") << "in destroy " << this << ", restore object is " + << d_pContextObjRestore << " at level " + << d_pContextObjRestore->getLevel() << ":" << std::endl + << *getContext() << std::endl; + } restoreAndContinue(); } - Debug("context") << "after destroy " << this << ":" << std::endl - << *getContext() << std::endl; + if( Debug.isOn("context") ) { + Debug("context") << "after destroy " << this << ":" << std::endl + << *getContext() << std::endl; + } }