Skip to content

Small number of invalidations when defining new AbstractUnitRange{Int} type #47143

@Tokazama

Description

@Tokazama

I consistently (across multiple Julia versions) have found a couple of invalidations whenever I define a new AbstractUnitRange{Int} type. It usually starts with a method like last(::OrdinalRange) but usually I can trace the issue back to last(::Slice). It's gotten a lot better in more recent releases (on v8.2 it only causes 2 invalidations), but I figured enough code interacts with Slice it was worth being proactive about it becoming a bigger issue later on.

I think it could be fixed if we changed its definition from Slice{T<:AbstractUnitRange} <: AbstractUnitRange{Int} to Slice{T<:AbstractUnitRange{Int} <: AbstractUnitRange{Int}. Is there any reason we don't enforce the indices have this subtype?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions