Skip to content

Use Static.jl to implement elements of Ones and Zeros? #176

@oschulz

Description

@oschulz

Currently, we have

Ones(5)[1] isa Float64

Using Static.jl, the elements of Ones could be static(1) or static(1.0), which would propagate the fact that the number is static deeper into calculations and could enable better compiler optimizations.

Static.jl is a comparatively lightweight dependency on top of FillArrays, load-time impact would probably be minor:

julia> @time using FillArrays
  0.398913 seconds (764.83 k allocations: 46.937 MiB, 72.11% compilation time)

julia> @time using Static
  0.062017 seconds (93.65 k allocations: 5.420 MiB)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions