optimization: improve __set_state construction time.