Skip to content

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

Closed
robx wants to merge 1 commit into
haskellari:masterfrom
robx:drop-length-rebase
Closed

withParams*: drop redundant call to 'length' by using 'withArrayLen'#32
robx wants to merge 1 commit into
haskellari:masterfrom
robx:drop-length-rebase

Conversation

@robx
Copy link
Copy Markdown
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
Copy Markdown
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