jump-dev / MathOptInterface.jl

A data structure for mathematical optimization problems
http://jump.dev/MathOptInterface.jl/
Other
392 stars 87 forks source link

MOI slow to import and precompile #2442

Closed theogf closed 8 months ago

theogf commented 8 months ago

I noticed that when running

@time_imports using Optim

Most of the time was taken by MathOptInterface:

2243.5 ms  MathOptInterface
22.1 ms  Optim

Additionally the precompilation takes a really long time. It surprising for a package that is supposed to be an interface?

This was run on Julia 1.9.3

odow commented 8 months ago

The name is misleading :smile: In fact, MOI is much more than an interface, and it is one of the largest Julia packages.

See https://julialang.org/blog/2021/08/general-survey/

image

That was in 2021. Now I get:

(base) oscar@Oscars-MBP MathOptInterface % cloc src
     179 text files.
     179 unique files.                                          
       0 files ignored.

github.com/AlDanial/cloc v 1.90  T=0.73 s (246.2 files/s, 121811.9 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Julia                          177           9174          17241          60660
JSON                             1              0              0           1281
Markdown                         1             43              0            181
-------------------------------------------------------------------------------
SUM:                           179           9217          17241          62122
-------------------------------------------------------------------------------

cc @blegat, why add MOI to Optim directly instead of a package extension?

odow commented 8 months ago

Regardless. Closing this as won't fix. You could open an issue at Optim.jl about moving MathOptInterface to a package extension.

blegat commented 8 months ago

Yes, it could be moved as a package extension

theogf commented 8 months ago

Cool! I'll make a PR to Optim.jl then!