Yeah, you likely would really have to post the code, though not necessarily publicly. Typical things to look for are of course just creating a ton of points or objects or overflowing arrays when sorting things in like reordering layers. If you use tons of loops I'd also start by truncating them with fixed values. A complex main loop can cause the weirdest issues when AI needs to update/ draw a ton of items all at once, especially with complex appearances or object/ layer interactions. In such a case it might make more sense to restrict the amount of loops and instead run the script multiple times or structure it in such a way that there's some intermediary refresh before entering the next iteration.
Mylenium