Might as well write this down...
Are you reading the data in every single time you do your calculation? Can you try an inplace method?
Is your function type stable?