Skip to content

Allocations in powers with literal exponents #66

Description

@rdeits

It looks like we're not quite handling literal_pow correctly:

julia> using SimpleQP

julia> model = SimpleQP.MockModel()
SimpleQP.MockModel(SimpleQP.Parameter[], Base.RefValue{Int64}(1))

julia> p = Parameter(() -> 1.0, model)
Parameter{Float64, …}(…)

julia> e = @expression(p^2)
LazyExpression{FunctionWrapper{…}(LazyExpression{Base.#literal_pow, …}(…))}(…)

julia> e()
1.0

julia> SimpleQP.findallocs(e)
LazyExpression{FunctionWrapper{…}(LazyExpression{Base.#literal_pow, …}(…))}(…): 48 bytes
  [1]: Base.#^
  [2]: Parameter{Float64, …}(…): 0 bytes
  [3]: DataType

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions