First of all, you're assuming the slowness is due to the full RAM, which is not necessarily the root cause. Theoretically there should be other reasons and bottlenecks that would lead to slowness occurrences, such as extensive I/O, too many processes expecting CPU etc, and you should first rule out other reasons before you decide the culprit is the memory. You could use vmstat command, for instance:
$ vmstat -w 1 procs -----------------------memory---------------------- ---swap-- -----io---- -system-- --------cpu-------- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 120951240 9412 8313416 0 0 0 2 0 0 0 0 100 0 0 0 0 0 120951248 9412 8313416 0 0 0 0 143 210 0 0 100 0 0 0 0 0 120950980 9412 8313416 0 0 0 20 116 238 0 0 100 0 0 0 0 0 120950980 9412 8313416 0 0 0 0 180 315 0 0 100 0 0 0 0 0 120951232 9412 8313416 0 0 0 0 145 285 0 0 100 0 0
If you see relatively high numbers under the swap section - si (swap in) or so (swap out) - that could indicate that the system is working out on swapping memory pages in and out the RAM to or from the swap. If the values there are low, there's probably another reason for the slowness (which you could probably see under procs, io or cpu).
Assuming you do see high swap in/out values in vmstat, that indicates that the bottleneck is indeed the RAM getting filled up.
Here's the description of swappiness from the Linux kernel documentation:
swappiness
This control is used to define how aggressive the kernel will swap memory pages. Higher values will increase aggressiveness, lower values decrease the amount of swap. A value of 0 instructs the kernel not to initiate swap until the amount of free and file-backed pages is less than the high water mark in a zone.
The default value is 60.
First, notice that your swappiness value (10) is significantly lower than the default (60).
Let's say your firefox has a lot of tabs; Most of them are idle and aren't used much. If the swappiness is low, the machine will try to keep their data in RAM as much as possible and to avoid swapping out until it really has to free some memory for new pages; This means that the machine will start swapping only in times of need, and then it might be a bit too late, and at that moment you'll see some lagging waiting for the old memory pages to get swap out.
If the swappiness is higher, the system will page out old and idle memory pages more frequently and ahead of time, leaving more of your memory free for new pages. When you access those tabs again it will page in their memory from disk to RAM so it might be slower, but since you don't use those tabs very frequently it's better to keep them in swap and keep more free memory pages available for new processes.
I would suggest to increase your swappiness, so old and unused memory pages are swapped out more frequently and not only when the memory reaches its limit.