Hi Suzanne,
Based on the limited info, could be any number of things. Below are a few suggestions.
1. File size: How many pages is the form? If it's somewhere in the vicinity of 40 pages, then performance will take a hit.
2. Events. What events are the JavaScript placed in? Often the event may be firing off more than once, so I'd recommend that you look at the PDF event model to decide the best event in which to place your code.
3. Dynamics. When and when are you firing this?
Cheers,
Eric Lau