CPU usage decrease dramatically after a while time running my code

I am running a python code which includes a lot of loops, i'm using python3 and Ubuntu 16 with an Intel quad core processor. It starts running fast, when I look to CPU usage the process is using 100% of a core thread. However, after a while the excution becomes slower, and the CPU usage decreases dramatically.

I've tried increasing the priority of the process (decreasing nice) but it doesn't seem to work.

I just want that my OS decides to assign full CPU usage to my process. Hope you can help me.

Edit: I've cheked memory use and it keeps under 30% of the RAM usage, so I don't think it may be a memory problem. Edit2: The code opens a file from a external disk every loop.