-
Notifications
You must be signed in to change notification settings - Fork 167
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
Unique vectors #550
base: dev
Are you sure you want to change the base?
Unique vectors #550
Conversation
We might want to add a few more apis (cutting an array short and dropping the the rest of the array), or extending an array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @TimWhiting, this looks a lot friendlier than my draft! I made a few minor comments regarding naming of variables and documentation.
I worry a bit that the unsafe surface area is quite large still. I think we can probably pay for two is-unique
checks per iteration of map
(given that the second can be well-predicted). Then we can make this API more clean by incorporating the copy
calls into unsafe-assign
and unsafe-idx-own
.
Yes, that would be fun! I think we could also support |
I think these sorts of APIs are maybe best left to a resizeable vector type, which could hold on to the length like you mention and have a resize policy for add / extending the vector as well. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
…d some documentation
2de1419
to
d7dffea
Compare
Addresses #544
@anfelor can you take a look at this?
I added a few public apis and a few private helpers.
Public:
set
update
update
for local variable vectorsThe most important function is the
copy
function, which ensures that the vector is unique prior to applying any mutation operations. For many cases we would expect it to be unique.