use a lookup-friendly structure when parsing relay addresses for better performance
For storing relay IP addresses that look like this:
{
"Dhcp4": {
"shared-networks": [
{
// List of IPv4 relay addresses for which this shared
// network is selected.
"relay": {
"ip-addresses": [
"192.168.56.1",
"192.168.56.2"
]
}
}
]
}
}
, a typedef std::vector<isc::asiolink::IOAddress> IOAddressList;
is used.
It could be a std::unordered_set<isc::asiolink::IOAddress>
for better performance. We treat it like a set in every regard. We look up addresses in it. If it contains a duplicate, it throws.
Here's a call graph that shows what percentage addAddress
and containsAddress
take out of parsing some shared networks with 114 subnets and 32 relay addresses.