On 2020/03/18 18:51, Florian Westphal wrote:
Right now (assuming static), size <= 16 bits is most efficient,
then <= 32 bit, rest uses hash table.
Very good to know. Thanks so much.
I suppose intervals are more efficient than an equivalent group of single
elements?
Memory-wise yes, performance-wise no.
Also good to know.
Is a concatenation like ipv4_addr . inet_service as efficient as a pure data
type with the same number of bits?
Yes, as it makes no difference for the storage. The kernel doesn't know
what its storing, it only knows the size of the element.
It does store a 'type' information, but that is only used by nftables
so it knows how to format the elements when listing the ruleset.
Thanks for confirming, and for all of your detailed answers.
If you find the time (and if it's comprehensible to a non-kernel
programmer): How does a dynamic set change the above situation? Does it
use a hash table for everything?
Thanks,
Frank