in reply to undef speedup ?!

I don't recall an exact discussion of this but there are some related comments (probably in the Camel book) that using delete keeps the stucture of the object allocated (and saves time if you need to refill the structure) whereas undef destroys the structure.

If you make the (reasonable for this datatype) assumtion that keys does a linear scan of the stucture to find valid keys then the behaviour is explicable and even expected.