Type test: optimizations