Is it MATLAB that is running slow on your computer or rather the programs you've written in MATLAB?
MATLAB makes heavy use of dynamic memory allocation and reallocation; MAtrix or array resizing can be very slow and non-deterministic; if a matrix or array grows, new memory is allocated and the existing data copied to the new memory before deleting the old copy. You can avoid this memory thrashing by pre-allocating such arrays: for example this code:
x = 0;
for k = 2:1000
x(k) = x(k-1) + 5;
end
causes x
to be resized on each iteration and will run very slow. By comparison the following code:
x = zeros(1, 1000);
for k = 2:1000
x(k) = x(k-1) + 5;
end
pre-allocates the array so that no resizing occurs and will run considerably faster.
The MathWorks website has a whole page detailing this and other performance improving techniques; the page covers the following:
- Preallocating Arrays
- Use Distributed Arrays for Large Datasets
- When Possible, Replace for with parfor (Parallel for)
- Limiting Size and Complexity
- Assigning to Variables
- Using Appropriate Logical Operators
- Overloading Built-In Functions
- Functions Are Generally Faster Than Scripts
- Load and Save Are Faster Than File I/O Functions
- Vectorizing Loops
- Avoid Large Background Processes
Note that the solution you have suggested is last on MathWorks' list, you should look at all the other points first, unless you are doing something obviously resource hungry like running a Virtual Machine, or playing high definition video at the same time as running MATLAB, looking at other processes running is probably sweating the small stuff.