Skip to content

withParams*: drop redundant call to 'length' by using 'withArrayLen' #32

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

Closed
wants to merge 1 commit into from

Conversation

robx
Copy link
Contributor

@robx robx commented Nov 4, 2022

This is the other left-over change from #22.

I'm a bit unsure whether this is a net win: It saves us one out of several redundant list length computing the parameter length list and a few lines of code, at the expense of arbitrarily breaking symmetry between the different equally long lists.

The nicer way to optimize this might be if Foreign.Marshal exposed something like unsafeWithArray len vals action.

We encode various arrays of the same length through 'withArray'.
Each of these computes the length, so we might as well take the
length from one of these.
@phadej
Copy link
Collaborator

phadej commented Dec 28, 2022

I noticed this just now. I think using unsafeWithArray is cleaner so I did so: #33

@phadej phadej closed this Dec 28, 2022
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.

2 participants