Update set.c

Modify several low-performance logic.