Mark Lawson has a piece in the Guardian about the ethics of walking out of a show in mid-performance.
I've never understood this problem.
Here's what you do:
Whisper "excuse me" to the person next to you, hit the aisle and fucking leave.
It's your time, your life, your night.
And if you're hating the thing, your presence is actually making it worse, you're not helping anyone by sitting there sleeping or fuming.
Get out of there. If the actors can't handle it, they shouldn't be up there. Stage acting is art in a shared public space in real time and the audience is not obligated to sit there and quietly suffer.
Get up and fucking go, folks.