Some data conversion and compression tools in the build process of some of my public and private programming projects for retro game consoles are time-consuming. For example, 240p Test Suite takes 10 seconds to run a DTE encoder on the help pages, and per Amdahl's law, the remainder of the build process has to stall on this one step no matter how many cores I devote to everything else. My pipelines are slow in part because they are written in the dynamic language Python and run in the CPython interpreter. I know of two ways to speed up a program written in Python:
Run the tools in PyPy
PyPy is a JIT comiler that speeds up pure-Python code. I tried this, and it didn't speed much up. It turned out a lot of the time was spent in PyPy's compatibility with CPython's extension API, which is slow. Many of these use Pillow (Python Imaging Library) to crop an image into 8x8- or 16x16-pixel chunks and do operations on each chunk's data, but the transition from PyPy to Pillow to PyPy to produce each such chunk is slow. A feature request for PyPy support in Pillow was closed as soon as it built, not as soon as it was fast. A fast PyPy extension uses CFFI.
Rewrite the extension in a less dynamic language
In this post, jroatch reported well over a hundredfold speedup by rewriting a data compression utility from Python to C. This is practical on Debian or Ubuntu, where I can just switch what packages I ask the user to apt install. But I'm not aware of how to make installing a C++ compiler and image reading and writing libraries for said compiler easy for my collaborators who use the Windows operating system. I've made a walkthrough for installing Git Bash, Make, Python, Pillow, and cc65 on Windows, but I'd need the same for a C or C++ compiler. I would also need to support my collaborators in case they miss a step in the walkthrough, the Windows GUI changes out from under them (which it has done), or a bug fix or enhancement to a tool breaks functionality on only Windows. And I imagine this will prove more difficult seeing as I have only occasional access to a Windows PC.
Which of these two options (or a third that I didn't mention but you will) is any good? And what else will I need to know to make it practical? For example, what image reading and writing library for Python is better than Pillow, and what image reading and writing library for C or C++ is any good?
Run the tools in PyPy
PyPy is a JIT comiler that speeds up pure-Python code. I tried this, and it didn't speed much up. It turned out a lot of the time was spent in PyPy's compatibility with CPython's extension API, which is slow. Many of these use Pillow (Python Imaging Library) to crop an image into 8x8- or 16x16-pixel chunks and do operations on each chunk's data, but the transition from PyPy to Pillow to PyPy to produce each such chunk is slow. A feature request for PyPy support in Pillow was closed as soon as it built, not as soon as it was fast. A fast PyPy extension uses CFFI.
Rewrite the extension in a less dynamic language
In this post, jroatch reported well over a hundredfold speedup by rewriting a data compression utility from Python to C. This is practical on Debian or Ubuntu, where I can just switch what packages I ask the user to apt install. But I'm not aware of how to make installing a C++ compiler and image reading and writing libraries for said compiler easy for my collaborators who use the Windows operating system. I've made a walkthrough for installing Git Bash, Make, Python, Pillow, and cc65 on Windows, but I'd need the same for a C or C++ compiler. I would also need to support my collaborators in case they miss a step in the walkthrough, the Windows GUI changes out from under them (which it has done), or a bug fix or enhancement to a tool breaks functionality on only Windows. And I imagine this will prove more difficult seeing as I have only occasional access to a Windows PC.
Which of these two options (or a third that I didn't mention but you will) is any good? And what else will I need to know to make it practical? For example, what image reading and writing library for Python is better than Pillow, and what image reading and writing library for C or C++ is any good?