Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use staged functions in @defVar #589

Closed
wants to merge 1 commit into from
Closed

Conversation

joehuchette
Copy link
Contributor

Ref #346, this adds a runtime version of our @gendict macro so that

@defVar(m, x[1:3])

and

T = 1:3
@defVar(m, x[T])

produce the same object (that is, x::Vector{Variable}). This implementation is type unstable, which I think is inevitable, given that we produce different types for T=1:3 and T=2:3. In the benchmarks updates I pushed, this lead to about a 4x performance hit in the worst-case, though there may be more serious performance hits in other settings.

This PR takes the current behavior, which has opaque difference in semantics, with something that has the same behavior, but opaque differences in performance. If the performance hit is just 4x, I think this may be a reasonable change (and could get better without all the evaling once we switch to proper JuMPArrays), but I'm not certain.

@mlubin
Copy link
Member

mlubin commented Sep 27, 2015

Why don't we just switch to the JuMPArray code now instead of further hacking? Did you want to get this into the 0.10 series?

@joehuchette
Copy link
Contributor Author

This seems a little too feature-y to put in 0.10.x. I'm fine trying to change JuMPArrays now, but that won't subsume this, just change some of the implementation.

@odow odow deleted the runtime-gendict branch December 30, 2018 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants