Skip to content
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

Contiguous vector storage #113

Closed
wants to merge 21 commits into from
Closed

Contiguous vector storage #113

wants to merge 21 commits into from

Conversation

regexident
Copy link
Collaborator

@regexident
Copy link
Collaborator Author

Apple's documentation for ContiguousArray states:

The ContiguousArray type is a specialized array that always stores its elements in a contiguous region of memory. This contrasts with Array, which can store its elements in either a contiguous region of memory or an NSArray instance if its Element type is a class or @objc protocol.

If your array’s Element type is a class or @objc protocol and you do not need to bridge the array to NSArray or pass the array to Objective-C APIs, using ContiguousArray may be more efficient and have more predictable performance than Array. If the array’s Element type is a struct or enumeration, Array and ContiguousArray should have similar efficiency.

For more information about using arrays, see Array and ArraySlice, with which ContiguousArray shares most properties and methods.

Source (emphasis mine)

What this boils down to is that for value types (and Surge's Scalar are value types, primitives even) the internal memory representation of Array and ContiguousArray should be the same, i.e. contiguous.

I'm gonna close this as we're not going to get any performance improvements from it and thus the more common type Array is preferable over the less well known ContiguousArray.

@regexident regexident closed this Sep 30, 2019
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.

1 participant