util: improve set API and optimize table clearing
this brings the set
API into closer parity with hash_table
and provides a minor optimization for the case where a set/hash_table are completely filled with deleted entries, avoiding unnecessary allocations