Since forwarding decisions are immutable, instead of allocating objects for forwarding decisions we could cache similar earlier decisions. This could take the form of a general caching layer, which users of Pax could tune or extend for their packet processors. Or it could take the form of a preprocessing step.
That is, instead of creating a new SinglePortForward each time we make a forwarding decision, if we have a single-port forwarding processor with 5 ports we could simply instantiate SinglePortForward 6 times (one for each port, and once for drop -- port -1) when the packet processor starts, then reference these instances during runtime.
Things might get a bit harder with MultiPortForward, where it might make more sense to have a caching layer rather than parameter-sweep at start-time as a preprocessing step.
Since forwarding decisions are immutable, instead of allocating objects for forwarding decisions we could cache similar earlier decisions. This could take the form of a general caching layer, which users of Pax could tune or extend for their packet processors. Or it could take the form of a preprocessing step.
That is, instead of creating a new
SinglePortForward
each time we make a forwarding decision, if we have a single-port forwarding processor with 5 ports we could simply instantiateSinglePortForward
6 times (one for each port, and once for drop -- port -1) when the packet processor starts, then reference these instances during runtime.Things might get a bit harder with
MultiPortForward
, where it might make more sense to have a caching layer rather than parameter-sweep at start-time as a preprocessing step.For more context see https://github.com/niksu/pax/pull/7#discussion_r70435683