mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
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:
parent
252cd33283
commit
92e73606ba
1 changed files with 6 additions and 3 deletions
|
@ -213,9 +213,12 @@ hash_t HashKey::Hash() const
|
||||||
if ( hash == 0 )
|
if ( hash == 0 )
|
||||||
hash = HashBytes(key, size);
|
hash = HashBytes(key, size);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
if ( zeek::detail::debug_logger.IsEnabled(DBG_HASHKEY) )
|
||||||
|
{
|
||||||
ODesc d;
|
ODesc d;
|
||||||
Describe(&d);
|
Describe(&d);
|
||||||
DBG_LOG(DBG_HASHKEY, "HashKey %p %s", this, d.Description());
|
DBG_LOG(DBG_HASHKEY, "HashKey %p %s", this, d.Description());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue