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

Fix unary minus operators in rewrite #325

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix unary minus operators in rewrite #325

wants to merge 3 commits into from

Conversation

odow
Copy link
Member

@odow odow commented Jan 24, 2025

Closes #323

@odow
Copy link
Member Author

odow commented Jan 24, 2025

The benchmark in #323 becomes:

julia> using JuMP

julia> function test1()
           model = Model()
           N = 1_000_000
           @variable(model, x[1:N])
           GC.gc()
           GC.gc()
           @time for i in 1:5
               @expression(model, sum(-1.0 * x[i] for i in 1:N))
           end
           GC.gc()
           GC.gc()
           @time for i in 1:5
               @expression(model, sum(-x[i] for i in 1:N))
           end
           GC.gc()
           GC.gc()
           @time for i in 1:5
               @expression(model, -sum(x[i] for i in 1:N))
           end
           return
       end
test1 (generic function with 1 method)

julia> test1()
  1.047293 seconds (235 allocations: 223.388 MiB, 1.38% gc time)
  1.011328 seconds (235 allocations: 223.388 MiB, 1.35% gc time)
  1.508724 seconds (240 allocations: 223.389 MiB, 0.91% gc time)

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.32%. Comparing base (1415163) to head (ac973fc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #325      +/-   ##
==========================================
+ Coverage   90.30%   90.32%   +0.02%     
==========================================
  Files          22       22              
  Lines        2238     2253      +15     
==========================================
+ Hits         2021     2035      +14     
- Misses        217      218       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Negative signs in expressions
1 participant