Skip to content

Conversation

@rreusser
Copy link
Member

@rreusser rreusser commented Jan 3, 2016

This PR bypasses pool.malloc if the dtype is array and returns simply new Array(sz). Some modules require (optional) allocation of output. This makes it consistent and less surprising to allocate storage of the same dtype without extra gymnastics.

@rreusser
Copy link
Member Author

rreusser commented Jan 3, 2016

Rejection of this PR is fine, but then we should document the expectation that, in general, for scijs modules that allocate new storage, the dtype of the output may not match that of the input.

@mikolalysenko
Copy link
Member

Hmm.. There is no way to do pooled allocation for generic ndarrays. However, I think it should be ok to do something like allocating a regular array using new Array(size) for both generic and array dtypes. free on a generic array could be a no-op.

@rreusser
Copy link
Member Author

rreusser commented Jan 3, 2016

Yeah. That makes sense. The use case is mainly avoiding an awkward if statement when generating an array identity matrix vs a typed array identity, for example. Maybe that should be a separate module, but this seems fairly harmless and somewhat simpler.

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