Hi Diogo,
Firstly, as Mike said is very important to spend some time looking to the process and try to optimize it. However, If you are working with heavy calculations you should do it in background using microflows + task queues.
Pay attention to the version of your project. Tasks queues were added few versions ago, so if you are using a old version of studio pro you will need to use one java action called “executeMicroflowInBackground” from community commons module.
Task queue doc: https://docs.mendix.com/refguide/task-queue/
Best Regards,
Ricardo Pereira
I just posted an answer to a similar question here: https://forum.mendix.com/link/space/studio-pro/questions/124021
If the process is taking a couple of hours, I would spend time looking at each step of the process to determine which parts of the process are most time consuming. Then you can work on performance of those. Its hard to say if Java or microflow actions will be quicker without looking at the specific microflow. However, if you can rely on the database server to do some of the processing, that could speed up your microflow.
You may also see some good ideas here that will help you rework your microflow for better performance: https://docs.mendix.com/refguide/performance-best-practices/