HashKey: Do not call Describe() unconditionally in DEBUG mode

An unnecessary overhead of the Hash() method was uncovered for DEBUG builds
due to computing a description of every HashKey() even when the DBG_HASHKEY
stream is not enabled. Squelch it.
This commit is contained in:
Arne Welzel 2023-02-14 10:36:27 +01:00
parent 252cd33283
commit 92e73606ba

View file

@ -213,9 +213,12 @@ hash_t HashKey::Hash() const
if ( hash == 0 )
hash = HashBytes(key, size);
#ifdef DEBUG
if ( zeek::detail::debug_logger.IsEnabled(DBG_HASHKEY) )
{
ODesc d;
Describe(&d);
DBG_LOG(DBG_HASHKEY, "HashKey %p %s", this, d.Description());
}
#endif
return hash;
}