Pathway analysis - speed of FGSEA versus Mitch

FGSEA is among the most used pathway enrichment tools due to its speed and straightforward design. While doing a comparison of different enrichment tools recently, I compared it against a tool called "mitch" and I noticed something interesting. Mitch was actually faster than fgsea. This is strange, because my own tests from 2020 published in BMC Bioinformatics showed that fgsea was >10x faster (fgsea version 1.11.1) (Fig 1).

Fig 1. Tests conducted in 2020 show FGSEA is 10x faster than mitch.

As emphasised in our 2020 paper, speed wasn't the main priority for our software. We were focused on enabling multi-dimensional analysis.

But given this curious observation, I did a systematic test of speed of fgsea and mitch using a real dataset to try and understand whether fgsea underwent some code changes that made it slower. The codes for my work are on GitHub, and I used the bioconductor docker images to repeat this across Bioconductor versions from 3-11 onwards. Before 3.10 is not available unfortunately.

What we see is that running processes in a docker container doesn't make them slower compared to native execution (Fig 2). Also mitch was faster than all fgsea tests done here. I am not sure about what changes fgsea had after fgsea v.1.11 but they have made a big difference to speed. Although fgsea has optimised C code for permutation based tests, that is computationally intensive. Mitch on the other had is written in pure R, but doesn't use permutations, it does an ANOVA-on-ranks test which is less computationally intensive but still slow because it uses base R functions.

Also notice how BioC3-11 fgsea is really slow. I repeated it separately and can confirm these numbers are correct.

Fig 2. Execution time for fgsea and mitch on TR1900X system.

From Fig 2 you can also see that parallelisation doesn't provide a linear speedup. Sure there are some parts of these tools that are single-threaded, but it looks like the overhead of managing >10 threads is high enough to cancel out the benefit of additional threads. Therefore, on this 16 thread Threadripper 1900X workstation, any more than 8 parallel threads is just a waste.

I also ran this test with BioC 3.19 on a newer 32 thread workstation (Threadripper PRO 5955WX), and the result was only slightly faster, in line the higher clockspeed and more PCIe lanes (Fig 3). 

Fig 3. fgsea and mitch on TR5995WX system (BioC3.19 docker image).


Based on this info in Fig 2 and Fig 3, the maximum number of parallel threads I would use for fgsea would be 8 and for mitch it would be 6. Using this smaller number of threads will also reduce RAM usage as compared to using all available threads.

Popular posts from this blog

Two subtle problems with over-representation analysis

Data analysis step 8: Pathway analysis with GSEA

Uploading data to GEO - which method is faster?