How can I reset cached routines?
I don't know if the title is accurate enough. I have a legacy code that I need to optimize. It's a routine written in objectscript. It accepts 4 parameters and runs 6 nested FOR...$ORDER reading a big global.
The thing is when I run the routine the first time it takes around 60 seconds to run. If I run it again it takes 5 seconds. If I wait around 6 to 10 minutes to run it again, it takes 60 seconds again, but if I run it every 1, 2, 3... minutes it still takes only 5 seconds to run.
I can guess there's some cached memory stuff somewhere making this happen. I've tried purging SQL queries and purging not needed journals. I knew it was not related but I don't know any other purging tools and I needed to try something.
So, am I guessing right and there's some garbage collector or memory management doing the trick? Can I force it to empty/reset so my routine takes its 60 seconds to run on every call and not once every 10 minutes? How can I know the time setup for the reset besides try and error? Am I wrong in these assumptions?