stripe / subprocess

A port of Python's subprocess module to Ruby
MIT License
209 stars 17 forks source link

Make Process#communicate do less work on every iteration #68

Closed jez closed 2 years ago

jez commented 2 years ago

Authored-by @synfo-stripe

Without this change communicating 700MB worth of data to 'cat' takes ~1h, with it it's closer to 1s.

My hypothesis is that input[0...written] = '' causes ruby to either allocate a whole new string buffer, or at the very least rewrite the entirety of the existing buffer, whereas input = input[written..] lets ruby use shared string optimization and only create a new RString pointing to the same buffer.

CLAassistant commented 2 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

qaisjp commented 2 years ago

What happens if you GIT_COMMITTER_EMAIL="jez@stripe.com" git commit --amend --author "jez <jez@stripe.com>"?