It is impossible to make performance recommendations without knowing what your intent on processing block definitions is and what result would be considered true. Looping through 100 blocks should be quick if the processing of each block definition had reasonable logic. For example, consider:
- Each dimension has a block named *D . Skip these
- Each layout is a block. If that is what you need to change there is a better way using (layoutlist)
- Xrefs are blocks named *|*. Can't modify those.
- Other unnamed blocks such as dynamic blocks *U00... Probably should skip those.
If you are trying to exclude any of those, then in the loop, filter those out first and then work what's left.
The block collection includes layouts also, each of which could have from none to thousands of objects.
Another way to process blocks is by using tblnext on the block table. To exit a while loop, you could use the exit function but should define an error handler first. The block table doesn't include layouts.
To exit a vlax-for loop early, you might put it inside a lambda function inside a vl-catch-all-apply and call the exit function in the loop. Not very good approach IMO since it hides all kinds of logic errors.
I use (vlax-for blk blks (vlax-for i blk)) to process every entity in the drawing but dimensions and xrefs shoud be filtered out.
Architect, Registered NC, VA, SC, & GA.