mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Preallocate booleans and small counts
Like PortManager, preallocate Vals for booleans and counts < 4096
This commit is contained in:
parent
a27ab672d9
commit
dcbef9cbe3
8 changed files with 136 additions and 41 deletions
24
src/Val.h
24
src/Val.h
|
@ -75,6 +75,30 @@ typedef union {
|
|||
|
||||
} BroValUnion;
|
||||
|
||||
class ValManager {
|
||||
public:
|
||||
ValManager();
|
||||
~ValManager();
|
||||
|
||||
Val* GetBool(bool b) const;
|
||||
Val* GetCount(int32 i) const;
|
||||
Val* GetCount(uint32 u) const;
|
||||
|
||||
Val* GetCount(int64 i) const;
|
||||
Val* GetCount(uint64 u) const;
|
||||
|
||||
private:
|
||||
Val* b_true;
|
||||
Val* b_false;
|
||||
std::array<Val*, 4096> int32s;
|
||||
std::array<Val*, 4096> uint32s;
|
||||
|
||||
std::array<Val*, 4096> int64s;
|
||||
std::array<Val*, 4096> uint64s;
|
||||
};
|
||||
|
||||
extern ValManager* val_mgr;
|
||||
|
||||
class Val : public BroObj {
|
||||
public:
|
||||
Val(bool b, TypeTag t)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue