Hello Martin,
I don't know how long the functions need to run the code.
But there are a few things you can do to speed up your code.
One thing is to use a single cycle loop for your code, which removes some overhead.
A second thing is to do calculations in parallel. Search for 'pipelining' .
Hope this helps.
Uli