mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
reduce number of needed hash operations
This commit is contained in:
parent
edd30da082
commit
d5b413c4e7
3 changed files with 8 additions and 21 deletions
|
@ -873,19 +873,17 @@ int Manager::SendEntryTable(const ReaderFrontend* reader, const int id, const Va
|
|||
HashKey* k = filter->tab->ComputeHash(idxval);
|
||||
if ( !k ) {
|
||||
reporter->InternalError("could not hash");
|
||||
return filter->num_val_fields + filter->num_idx_fields;
|
||||
assert(false);
|
||||
}
|
||||
|
||||
InputHash* ih = new InputHash();
|
||||
ih->idxkey = new HashKey(k->Key(), k->Size(), k->Hash());
|
||||
ih->valhash = valhash;
|
||||
|
||||
if ( filter->event && updated )
|
||||
Ref(oldval); // otherwise it is no longer accessible after the assignment
|
||||
filter->tab->Assign(idxval, k, valval);
|
||||
|
||||
InputHash* ih = new InputHash();
|
||||
k = filter->tab->ComputeHash(idxval);
|
||||
ih->idxkey = k;
|
||||
ih->valhash = valhash;
|
||||
//i->tab->Delete(k);
|
||||
|
||||
filter->currDict->Insert(idxhash, ih);
|
||||
|
||||
if ( filter->event ) {
|
||||
|
@ -1557,7 +1555,7 @@ HashKey* Manager::HashValues(const int num_elements, const Value* const *vals) {
|
|||
if ( data == 0 ) {
|
||||
reporter->InternalError("Could not malloc?");
|
||||
}
|
||||
memset(data, 0, length);
|
||||
//memset(data, 0, length);
|
||||
for ( int i = 0; i < num_elements; i++ ) {
|
||||
const Value* val = vals[i];
|
||||
position += CopyValue(data, position, val);
|
||||
|
@ -1695,11 +1693,3 @@ Manager::ReaderInfo* Manager::FindReader(const EnumVal* id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
string Manager::Hash(const string &input) {
|
||||
unsigned char digest[16];
|
||||
hash_md5(input.length(), (const unsigned char*) input.c_str(), digest);
|
||||
string out((const char*) digest, 16);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
|
@ -202,8 +202,6 @@ private:
|
|||
|
||||
vector<ReaderInfo*> readers;
|
||||
|
||||
string Hash(const string &input);
|
||||
|
||||
class Filter;
|
||||
class TableFilter;
|
||||
class EventFilter;
|
||||
|
|
|
@ -302,7 +302,6 @@ Value* Ascii::EntryToVal(string s, FieldMapping field) {
|
|||
break;
|
||||
|
||||
case TYPE_PORT:
|
||||
val->val.port_val.port = 0;
|
||||
val->val.port_val.port = atoi(s.c_str());
|
||||
val->val.port_val.proto = TRANSPORT_UNKNOWN;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue