Is Swap File slower than Swap partition in Ubuntu 20.04

Ask Ubuntu Asked by Aadithya Sathya on December 12, 2020

I am programming in python containing numpy array sizes of 200 million for one of my machine learning projects.

During the execution of the program the swap memory is also getting utilized for which I have created enough swap partition (Around 40GB)

I would like to extend my swap partition by creating a swap file. I have a doubt whether the read and write speed of the swap file will be slower than the swap partition ?

Looking forward for some replies on the same



One Answer

Once in place, a swap file is used the same way as a swap partition. Through the swap file or swap partition, the kernel knows which sectors are allocated for this use, and uses this space for swapping memory. As such, there fundamentally will be no difference in performance.

A swap file, however, may be fragmented. That would degrade performance on a traditional hard drive, but less so on an SSD.

Correct answer by vanadium on December 12, 2020

Add your own answers!

Related Questions

When I use the Universal USB trouble

1  Asked on January 6, 2022 by seth-audet


Cannot install virtualbox 5.1 on Ubuntu 17.04

2  Asked on January 6, 2022 by an-unknown-developer


Updated my system, now VMWare can’t update its kernel modules

1  Asked on January 6, 2022 by will-matheson


I broke MySQL and can’t figure out what’s wrong

0  Asked on January 6, 2022 by abdul-hakeem


Fix root permission

1  Asked on January 6, 2022


How to substitue Calibri Regular with Calibri ligth

1  Asked on January 6, 2022 by martien-lubberink


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir