You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The _fast routines need to use typedmemove and typedmemclr to update the keys and values. Instead, we should return a pointer to the key and value and have the caller update them. That way, the caller can just do a direct write in the case where the key or value has no pointers.
As an alternative could the map functions themselfs check if the type contains pointers and only use typedmemmove if writeBarrier.needed?
This would keep additional code outside the map functions small.
@martisch I've had a change implementing that locally for a while. (IIRC, it led to me filing #20934.) I'll experiment a bit with alternatives here before sending anything.
The reason I suspect returning the key pointer may be faster is because then the caller could use a more specialized write in the pointer case. For example, if it's a pointer key, the fast path would be just a few instructions. But it would probably be worth trying out both and comparing them.
The _fast routines need to use typedmemove and typedmemclr to update the keys and values. Instead, we should return a pointer to the key and value and have the caller update them. That way, the caller can just do a direct write in the case where the key or value has no pointers.
... and maybe the non-fast versions also?
See #21297
@josharian @aclements
The text was updated successfully, but these errors were encountered: