optimize hasSideEffects