Skip to content

Array.blocks performance #7832

Closed
Closed

Description

@d-v-b

Accessing the .blocks property of an array involves creating an object-dtype numpy array containing the array's dask keys: https://github.com/dask/dask/blob/main/dask/array/core.py#L1824.

When iterating over arrays with a lot of blocks, this numpy array of dask keys is created repeatedly (once per iteration), which leads to substantial overhead. Would it make sense to either cache this numpy array (in the same way that the keys themselves are cached) or skip the numpy array step entirely and slice the keys directly? And maybe there are other solutions?

cc @jakirkham

Activity

  1. jrbourbeau commented on Jun 24, 2021

    @jrbourbeau
    Member

    Thanks for raising an issue @d-v-b! If possible, slicing over the keys directly seems like a nice option

  2. jrbourbeau commented on Oct 12, 2021

    @jrbourbeau
    Member

    I believe this was closed by #7922. @d-v-b feel free to re-open if that's not the case

  3. jakirkham commented on Oct 12, 2021

    @jakirkham
    Member

    Yeah that seems to be the case. The OP of that PR mentions that, but am guessing the extra # confused GH. So it didn't close the issue on merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions