Add configure option for preallocating PortVal objects

This commit is contained in:
Tim Wojtulewicz 2023-03-14 13:37:35 -07:00
parent aa3053db00
commit 4f902c0f39
5 changed files with 41 additions and 0 deletions

View file

@ -339,7 +339,12 @@ public:
const PortValPtr& Port(uint32_t port_num);
private:
#ifdef PREALLOCATE_PORT_ARRAY
std::array<std::array<PortValPtr, 65536>, NUM_PORT_SPACES> ports;
#else
std::unordered_map<uint32_t, PortValPtr> ports;
#endif
std::array<ValPtr, PREALLOCATED_COUNTS> counts;
std::array<ValPtr, PREALLOCATED_INTS> ints;
StringValPtr empty_string;