optimize switch: 4.57 s