# IncompleteLU.jl efficiency much worse than Matlab ilu

**URL:** <https://discourse.julialang.org/t/incompletelu-jl-efficiency-much-worse-than-matlab-ilu/106062>\
**Category:** Numerics\
**Tags:** question, package\
**Created:** [November 11, 2023, 3:31am UTC](https://discourse.julialang.org/t/incompletelu-jl-efficiency-much-worse-than-matlab-ilu/106062 "2023-11-11T03:31:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rli1996](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@rli1996](https://discourse.julialang.org/u/rli1996)\
**Post date:** [November 11, 2023, 3:31am UTC](https://discourse.julialang.org/t/incompletelu-jl-efficiency-much-worse-than-matlab-ilu/106062/1 "2023-11-11T03:31:52Z")

</div>

Hello Julia user,

I’m developing a model with large matrix and systems of linear equation solver. I plan to change the original matlab code in Julia as I heard Julia is much faster than MatLab.

However, I found ilu in Julia is very slow and can lead to out of memory with small tolerance, but ilu() on matlab can always finish in 1s. My sparse matrix size is 10^6\*10^6. Did I use a wrong function or variable format (current is SparseMatrixCSC)?

I used @btime to measure the elapsed time, but I found without @btime the code runs much faster.

I’m a green hand to Julia. Thank you for any replies and suggestions in advance!

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [November 11, 2023, 7:21am UTC](https://discourse.julialang.org/t/incompletelu-jl-efficiency-much-worse-than-matlab-ilu/106062/2 "2023-11-11T07:21:49Z")

</div>

Could you show a minimum working example demonstrating the issue?

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [November 11, 2023, 8:52am UTC](https://discourse.julialang.org/t/incompletelu-jl-efficiency-much-worse-than-matlab-ilu/106062/3 "2023-11-11T08:52:10Z")

</div>

Welcome to the Julia forum! 👋

A small remark on `@btime` – that of course runs the code more than once, to report proper timing and not just once like e.g. `@time` (or MATLABs `tic() ... toc()`), cf [Manual · BenchmarkTools.jl](https://juliaci.github.io/BenchmarkTools.jl/stable/manual/#Benchmarking-basics) – or use `@benchmark` to see a larger summary of that.  
So for sure without benchmarking the code is faster.

---

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [April 17, 2025, 6:01pm UTC](https://discourse.julialang.org/t/incompletelu-jl-efficiency-much-worse-than-matlab-ilu/106062/4 "2025-04-17T18:01:11Z")

</div>

Sorry to revive this thread but it was never concluded and I ran across it now.

By default, MATLAB computes the no-fill ILU decomposition “ILU(0)”. The Julia package implementing the equivalent factorization is ILUZero.jl. This is different from IncompleteLU.jl (which appears to be used by the original post), which implements the Crout ILU. The Crout ILU is also available in MATLAB via non-default options.

So the original issue appears to be a result of comparing different algorithms computing different factorizations.
