... please always consider: can this loop become impossibly long? If you are iterating over anything without set limits then the answer is likely yes. Typically, nodes, files, users, terms, comments, aggregator items, menu links are the things that some sites can easily have millions of. Roles and vocabularies are an example which are very unlikely to become unwieldy large.
Thanks NK
