Quick perf test
Optimizations for sanitizeKey

This made key sanitization about twice as fast in my benchmark.
Further optimization and simplification of keys

Using string instead of []string for keys and namespaces.