Hello all!
I have been experimenting with our async API methods over on gitbom-rs-cli.
Most recent experiment: https://github.com/nellshamrell/gitbom-rs-cli/pull/21
Previous experiment: https://github.com/nellshamrell/gitbom-rs-cli/pull/18
As noted in the comments on the previous experiment, I'm not seeing a performance gain when using the async methods (in fact, there appears to be a performance penalty, though it is of course possible I'm blocking on something unintentionally). GitBOM is heavily dependent on many file reads and file writes and, as the tokio documentation states:
"Although it seems like Tokio would be useful for projects that simply need to read a lot of files, Tokio provides no advantage here compared to an ordinary threadpool. This is because operating systems generally do not provide asynchronous file APIs."
It's possible we could make use of io_uring, there has been some experimental work done on this (including with tokio) but support for it is still not wide-spread. This would also only benefit us on Linux, not on Windows. It is possible there is some sort of library that would support async file operations on Windows, but then we would need to maintain two separate sets of functionality - one for Linux and one for Windows. This is not impossible, but it adds to complexity and increases the maintainership burden more than it needs to at this time (imo).
The work that was done to add the async methods was tremendously valuable - I know I learned a lot and I believe other maintainers did as well. However, I propose removing the async API calls at least for now, and leaving it the project which uses the library to decide how to implement performant use of it through threads, etc. We can always add this functionality back in should it become necessary.