There are three main issues which cause performance degridation, you can check for issues with these bottlenecks using the
When your CPU has way too much to process, it tries to prioritise what items should be processed first and how busy the system should be allowed to get. This is complicated by multi-processor and scaling processor technologies but it's basically an easy thing to check.
As the processor gets busier the system will slow down in response.
IO (Input/Output) aka Disk Activity
This is a key issue for modern machines with plenty of RAM and strong processors. The fact is, there is only so much bandwidth on the PCI bus and in-between all the parts of the computer. Copying files from the hard drive to the network causes slowdown in disk access and device access.
Accessing files creates file caches in memory and uses processing power to generate protocols needed to shuffle the data to a different place.
If your computer ran out of memory, your programs would simply halt and/or crash. Instead the system starts putting lots of application data onto the swap partition. If you have a very intensive process that uses all of your ram, then you will find the entire of gnome and the ubuntu desktop will be saved to disk in the swap while the process completes.
Trying to load another process will take time as the data has to be recovered from the swap area which is orders of magnitudes slower than ram. Even when your process has finished, there will still be large chunks of important system data in swap which will degrade performance when it's pulled back for use.
Obviously communicating with the disk causes i/o overhead and swapping is to be avoided if at all possible. This last item is the most likely cause of your issues and I'm sorry to say, there isn't much that can be done about it. Make sure your processes are really gone using the
top command mentioned above and if they are, be patient with your computer as it tries to recover large chunks of memory from the disk just after such processes.