Sounds like you need to profile your code and find out where it is spending its time.
Reply to this message by going to Community
Start a new discussion in Performance Tuning at Community