-
Notifications
You must be signed in to change notification settings - Fork 987
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
provide control over transcoded-port buffer sizes #708
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jltaylor-us
reviewed
Jul 27, 2023
owaddell
force-pushed
the
owaddell/transcoded-port
branch
from
July 27, 2023 13:45
ed5da1f
to
5fe5434
Compare
Looks good to me. |
burgerrg
approved these changes
Jul 31, 2023
Use get-string-all in fresh-line mats where the expected result from block-read relied on the input-port's buffer size.
The string-ports mat expects prettytest.ss to be ASCII. Unicode characters in the files comprising prettysrc can break the test. Add hint to help the next person who stumbles on this. We could update the prettytest.ss make rule to convert the output to ASCII, but that would add a build dependency on something like iconv. We could do the conversion in Scheme, but that would rely on the system under test.
Add transcoded-port-buffer-size to provide control over the string buffer allocated for a new transcoded port. For transcoded input ports this also governs the size of an internal fxvector used by port-position. Add make-codec-buffer to allow control over the internal bytevector buffer for a transcoded port. Note that we get a few new "Expected error" cases for some io.ms mats that were extended by adding new parameters clauses. The mat parameters clause re-runs the mat body with different parameter settings. Here that means we happen to repeat some tests that check expected errors.
Avoid extra allocation and copying when get-bytevector-all, get-bytevector-n, get-string-all, and get-string-n can construct the result from a single file-buffer-size block.
Allocate minimum-sized buffers for transcoded port and codec when the bytevector argument is less than file-buffer-size. Avoid extra allocation and copy of result in that case. Take advantage of shared buffer if user has determined this is safe.
owaddell
force-pushed
the
owaddell/transcoded-port
branch
from
August 2, 2023 02:28
5fe5434
to
821879d
Compare
burgerrg
approved these changes
Aug 2, 2023
Thanks for the reviews, folks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds two new parameters that provide control over the size of the string buffer and the internal codec bytevector buffer associated with transcoded ports. It also includes changes to reduce allocation and copying in certain cases for
bytevector->string
,get-bytevector-all
,get-bytevector-n
,get-string-all
, andget-string-n
.One use case for the new parameters is to allow transcoded custom binary ports to take advantage of larger buffer sizes. Previously, such ports were effectively constrained by a fixed 1024-byte internal codec buffer even if created with a large
custom-port-buffer-size
.Resolved questions:
ioffsets
fxvector if the underlyingbp
does not supportport-position
? (Yes. Updated to avoid allocatingioffsets
fxvector in this case.)make-codec-buffer
procedure takebp
andmin-size
instead of justbp
? (For now keepingbp
as the only argument.)latin-1-codec
, but that's seems pedantic.)min-size
argument is a reminder that there is in fact a minimum lengthmake-codec-buffer
into one? (Yes. Done.)