Context switch micro-optimization