The first time I write something, I am very poor at editing it. At that point in time, I am in the middle of the written action, trying to get it right. I'm too close, I'm part of the story as a silent invisible character. So, I've learned to put it away as soon as I've finished it, the longer the time interval before I see it again, the better. When I next get the story out, my life has moved on and I'm not as involved. I can see the words rather than just experience being in them, and as a result, I start to see grammar and spelling errors and correct them. Best of all is to put it away yet again a second time for much longer, and only then tackle editing the piece one more time. At that point, I am completely outside the story looking at it like an object, able to see the entirety and to shape everything to support and fit the whole work. I am least disturbed by hacking away unnecessary bits once a long rest has passed, because every word is no longer individually precious - one forgets the pain of childbirth quickly, in the beauty of the growing child.
I think editing your work three times is probably the minimal requirement (just after drafting, again after a day or two, and one more time after quite a while such as months or even a year). In reality, I edit over and over. Whenever I write, I start each session by re-reading the previous chapter or chapters in the story, so that I set the stage in my brain for the subsequent action to play itself out upon. I do not hesitate to edit with every reading. So, by the time I post something here, it has been tuned many times. It took me a year to write "Timmy," and then a second year to revise the story. As I prepare each chapter for its premiere posting, I am mercilessly re-stomping all over it.
That doesn't mean some errors don't slip through. I write in solitude, and disallow feedback and email for my own reasons, so I am my own editor. The downside is that I have to let whatever falls through, be (after I posted today, I noted two "anyways" in the same paragraph - ack). It's not unlike painting a picture or sculpting ceramics - there is NEVER a moment that I as the artist ever feel like the piece is completely done. So, I guess the writing is the same way. I do not permit myself to edit again after posting/publishing, because it really would become a never ending process if I let it. Perfection isn't achievable, or perhaps, imperfection is as perfect as it gets.