mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 21:18:20 +00:00
Preallocate all possible PortVals.
The performance benefit is small (maybe ~1% at most), however, it's a trivial change without downsides.
This commit is contained in:
parent
895e7b06b1
commit
1e4964de77
29 changed files with 139 additions and 68 deletions
|
@ -33,13 +33,13 @@ static Val* parse_port(const char* line)
|
|||
}
|
||||
|
||||
r->Assign(0, new AddrVal(htonl(addr)));
|
||||
r->Assign(1, new PortVal(port, TRANSPORT_TCP));
|
||||
r->Assign(1, port_mgr->Get(port, TRANSPORT_TCP));
|
||||
r->Assign(2, new Val(good, TYPE_BOOL));
|
||||
}
|
||||
else
|
||||
{
|
||||
r->Assign(0, new AddrVal(uint32(0)));
|
||||
r->Assign(1, new PortVal(0, TRANSPORT_TCP));
|
||||
r->Assign(1, port_mgr->Get(0, TRANSPORT_TCP));
|
||||
r->Assign(2, new Val(0, TYPE_BOOL));
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ static Val* parse_eftp(const char* line)
|
|||
}
|
||||
|
||||
r->Assign(0, new AddrVal(addr));
|
||||
r->Assign(1, new PortVal(port, TRANSPORT_TCP));
|
||||
r->Assign(1, port_mgr->Get(port, TRANSPORT_TCP));
|
||||
r->Assign(2, new Val(good, TYPE_BOOL));
|
||||
|
||||
return r;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue