he he
Yeah, it's not exactly "efficient" - but it works.
If the above times out - it shouldn't hurt to simply run it again - as each time it's grabbing anonymous posts and processing them. So if you have to rerun it, it'll just keep picking anonymous posts and looking up the user.
Also - the last little tidbit will be to update post counts (counting up all their posts) so that their profile is correct. I'll make you a separate little script for that. So that after you're done, you can run that and then the user's post counts will be correct.