# JuMP vs SAS

**URL:** <https://discourse.julialang.org/t/jump-vs-sas/34520>\
**Category:** Performance\
**Tags:** first-steps\
**Created:** [February 12, 2020, 3:23pm UTC](https://discourse.julialang.org/t/jump-vs-sas/34520 "2020-02-12T15:23:58Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Albert\_Zevelev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albert_zevelev/32/11844_2.png) [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Post date:** [February 12, 2020, 4:35pm UTC](https://discourse.julialang.org/t/jump-vs-sas/34520/5 "2020-02-12T16:35:44Z")

</div>

@Dominic_Pazzula  
1 welcome to Julia Discourse  
2 When ppl [benchmark program speeds](https://discourse.julialang.org/t/julia-slower-than-matlab-python-no/33128) they usually wanna put the program inside a function & separately do a warmup run to separate “compile time” from “run time”.  
Consider below:

```nohighlight
using BenchmarkTools
using Ipopt
using JuMP

function f()
    model = Model(with_optimizer(Ipopt.Optimizer, print_level=0))
    @variable(model, x, start = 0.0)
    @variable(model, y, start = 0.0)

    @NLobjective(model, Min, (1 - x)^2 + 100 * (y - x^2)^2)
    optimize!(model)
    println("x = ", value(x), " y = ", value(y))

    # adding a (linear) constraint
    @constraint(model, x + y == 10)
    optimize!(model)
    println("x = ", value(x), " y = ", value(y))
end

@time f() #warmup: 15.044558 seconds (44.22 M allocations: 2.180 GiB, 7.24% gc time)
@time f() #0.012105 seconds (2.12 k allocations: 145.898 KiB)
@benchmark f() #

function g()
    model = Model(with_optimizer(Ipopt.Optimizer, print_level=0))
    @variable(model, x, start = 0.0)
    @variable(model, y, start = 0.0)

    @NLobjective(model, Min, (5 - x)^2 + 100 * (y - x^2)^2)
    optimize!(model)
    println("x = ", value(x), " y = ", value(y))

    # adding a (linear) constraint
    @constraint(model, x + y == 10)
    optimize!(model)
    println("x = ", value(x), " y = ", value(y))
end

@time g() #0.077067 seconds (97.75 k allocations: 4.977 MiB)
@time g() #0.023970 seconds (2.50 k allocations: 162.836 KiB)
@benchmark g() #

```

You only have to pay the price of compile the first time you open Julia REPL. The founders are [well aware of this](https://www.youtube.com/watch?v=TPuJsgyu87U) & reducing compiler latency is a top priority.  
I personally only minded it my first few weeks w/ Julia.

---

_[View the full topic](https://discourse.julialang.org/t/jump-vs-sas/34520)._
