How A KDE Developer Used C++17 & Boost.Python For About A 8,000x Speed-Up

Written by Michael Larabel in Free Software on 11 July 2018 at 08:15 AM EDT. 59 Comments
FREE SOFTWARE
Open-source developer Antonio Larrosa who contributes to KDE and openSUSE has been developing a command-line music manager called Bard. He's written an interesting post about how he sped up some of his operations by around eight-thousand times faster.

In particular, Antonio was focused on speeding up the process of finding song/music duplicates in the user's local music collection. What started out as Python code was morphed into optimized C++ code. Little surprise, the C++ code once tuned was immensely faster than Python -- but the blog post is interesting for those curious about the impact of the various steps he took for tuning this implementation.

Rather than rewriting the entire program in C++, he used the Boost.Python library that allows seamless interoperability between C++ and Python code. From there he began writing C++ code where relevant. In particular, he focused on C++17 and making use of threading. Further increasing the performance was tuning of the C++ compiler flags and also switching from GCC 7.3 to GCC 8.1.

Long story short, "This commit gave the last increase of speed, to 7998x, 36680 songs/second and would fully process a music collection of 1000 songs in just 13 seconds." Those curious about the steps he pursued for this speed-up in transitioning the performance sensitive code from Python to C++ can be found via this blog post. Those interested in learning more about his Bard music manager can visit the project site.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week