optimize the "for" loop

Signed-off-by: marpy <gh19900922@gmail.com>