Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed all the Powershell calls to the "echo" cmdlet to use "out-file" with the "-append" option instead #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arizvisa
Copy link

@arizvisa arizvisa commented Jun 9, 2020

This PR is a preliminary re-implementation of the appendContent function which uses out-file with the -append parameter instead of echo w/ a redirect. Using echo w/ a redirect will typically result in a unicode-type encoding which uses 16-bit wchar_t internally resulting in twice as much base64 encoded data needing to be decoded. By using out-file with a utf8 encoding, this should halve the base64 data that is written to the file which "might" make things a little faster. I think we can use 7-bit ascii due to base64, but to be safe I chose utf8 because it's universal.

However, I believe the same amount of data is being transferred over a socket, but during the decoding process, less data needs to be processed. Also, to execute an i/o redirect the command has to be executed, have its output captured, a handle needs to be created for the file, data needs to be appended (a seek), and then the handle has to be closed. Using out-file keeps all functionality within the same implementation and doesn't need to process any of the extra features of write-output which supports different logging classes and other special formatting (which can have some implicit performance issues).

This is based on the first suggestion I made in PR #6. It hasn't been tested too well, but should have the exact same semantics as the original implementation. I have not comprehensively measured its performance. :-/

…o reduce the number of bytes that are written as "echo" uses unicode (by default).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant