Skip to content

Optimise VarNamedVector.num_inactive #1101

@mhauru

Description

@mhauru

Currently VNV's num_inactive field is a Dict{Int,Int} (or before #1098 an OrderedDict{Int,Int}). As @penelopeysm noted in #1098 (comment), that's equivalent to a SparseVector, which might be more performant. We could also afford to store a dense Vector if that's faster (it's no longer than some of the other vectors).

I also suspect that num_inactive is almost always zero for all variables. It might thus be worth making it Union{Nothing, Dict{Int,Int}} or Union{Nothing, (Sparse)Vector{Int}}, where the nothing would mark no variable as having inactive entries, and these checks could be compiled away. num_inactive is checked on every call to getindex_internal(vnv, Colon) and update_internal!!, so this might make a difference.

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