I would like to contribute fix for the following issue:
The corresponding PR:
I tried to follow the approach suggested in the comments of the said ticket and any feedback is appreciated. This is my first attempt to contribute to Beam code, so please bear with me if I missed something important.
To give you some background on why I'm fixing this:
I understand that performance related issues in direct runner generally receive low priority as the whole direct runner concept is not meant for a production deployment. Yet I think that this issue should receive reasonable attention because even if being used in testing/CI pipelines, the increased CPU consumption may materialise in a form of higher bill from your favourite cloud provider. This definitely is our case and it makes this issue a high priority one for us.