Two different capacity memory modules will be just fine.
If you get two modules of different speeds then the computer should run at the speed of the slowest modules. In in 99% of all cases will automatically.
In many cases you can also use a few memory modules in a special way and gain some extra speed. There are several ways this can be done (interleaving modules, dual channel, triple channel, quad channel, ...) but the most common on is dual channel and it yields about 5% speed extra speed without needing extra hardware. 5% is not shocking, but 5% speed for free is nice. So many people get told they should buy identical DIMMs.
Having said that, more RAM usually trumps the extra speed from dual channel.
That leaves only these things:
- Get memory which your motherboard supports. E.g. difference between SoDIMM and a regular DIMM. No quad-rank modules on non-servers. Do not mix normal unbuffered and buffered/registered modules.
Most of this you can safely ignore since almost all consumer memory is the same: unbuffered, no ECC, no parity). Unless you spent effort to find something exotic you will get the right stuff.
- Get memory which is the same voltage as the other already installed memory. (e.g if your first DIMMs is rated 1.5 to 1.65v and you get a second one rated 1.35 to 1.5 volt things should work fine at the 1.5v setting. (Older modules often work at a higher voltage and are not guaranteed to work at a lower one.)
- Make sure you still have an empty memory socket. :)
Memory speed vs amount explanation:
Say I have an encrypted file (e.g.
my_secrets.aes) which is 1GiB in size. I want to decode it and I will access the whole file over and over again.
If I do this on a computer with 2 GiB then the computer will boot, load the OS. You can start the cracker program and load the file. The file will be cached in the memory. The first time I to decrypt/break the file I will try to brute force it with some key A. Next I try the following key on the same file, just as long until I find the right key to decrypt it with.
Every time I will need to access the whole file. The OS will have a copy in the disk cache which means it will only need to be loaded from disk once. That is a nice part of having enough memory. And since I choose a 2GiB host and did not start any other programs the file will fit completely into the disk cache.
Secondly I do the same thing with a 4GiB computer. It will not be any faster.
On the third attempt I do the same thing with faster memory. The CPU can read faster from the memory and the whole decoding will go faster.
This shows why faster memory can have advantages.
Not that this is an extreme advantage. I run no other programs which use memory. I had a file size which was significantly larger than the cache on a modern CPU, forcing the program to continuously read from memory.
On regular day to day usage you will have several program running: E.g. a web browser or two, a mail client, a virus scanner, an open spreadsheet, a music player, ... All of these use memory and all of these profit from having some of their data in the disk cache. Actually, not just their data. If I start word, write a shopping list and then save word then the disk cache will have part of the word program. The next time I start it not all of that program needs to be loaded from slow disk. Instead it can use the faster in memory data.
This is another somewhat extreme side where I start a program. Exit it and then start it again.
Now in most cases of day to day usage there is a mix of both. Faster memory helps. More memory helps. But on average for Jane Regular there is an bigger speed advantage with more memory over bigger memory.