Thank you for your post.
I am unable to replicate the issue, as I am looping through 100,000 records. I'm not doing anything intensive in the loop, so perhaps you could let me know what steps you are executing within the loop, as this may be the key.
The script steps don't matter; it is slow regardless of the script whenever the data viewer is open with debugger. I will send you more info back-channel.