For lots of programming tasks there is often a tradeoff between speed and memory. In your case, you can probably speed things up if one of the array dimensions is rounded up to the next larger power of 2. That becomes clear when you use a one dimensional array for the storage and do the adress calculation on your own.
For the sake of simplicity, lets assume vlan is in the range 0...4094, and look at this example (pseudo code):
return Content[port * MAXVLAN + vlan];
return Content[vlan * MAXPORT + port];
If either MAXVLAN or MAXPORT is a power of two, the multiplication is a just a shift operation, which is typically faster on most contemporary processor architectures than a multiplication with an arbitrary number. So you can pick
MAXPORT=32 (and waste some entries in your array), or
MAXPORT=30 (which is memory efficient, but wastes some CPU cycles). So pick your choice.