You always optimize WITH REGARDS to something.
So depending what your needs are, the result and the way may be different.
However, if your computer "freezes" often, then your optimal solution may be to first address this problem, which may have many causes, like:
- malware and viruses,
- leftovers from previously installed programs,
- memory errors,
- harddrive problems,
- incompatible drivers,
- low memory
etc.
In order to get more detailed help from anyone, you'd need to give a bit more details on your problems.
(Some bright person may even say that the optimal solution would be to wipe and make clean install, change to a different OS or even buy a new computer... and, depending on your situation and budget, that could even be true...)