# Performance with JIT for FENICS and or FENICSx

**URL:** <https://fenicsproject.discourse.group/t/performance-with-jit-for-fenics-and-or-fenicsx/8523>\
**Category:** mathematics\
**Created:** [June 12, 2022, 3:32pm UTC](https://fenicsproject.discourse.group/t/performance-with-jit-for-fenics-and-or-fenicsx/8523 "2022-06-12T15:32:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zitterbewegung](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/zitterbewegung/32/3883_2.png) [@zitterbewegung](https://fenicsproject.discourse.group/u/zitterbewegung)\
**Post date:** [June 12, 2022, 3:32pm UTC](https://fenicsproject.discourse.group/t/performance-with-jit-for-fenics-and-or-fenicsx/8523/1 "2022-06-12T15:32:28Z")

</div>

Hi, I was wondering how the JIT in FENICS could be turned off. I am noticing that there is a large variance between computations being run either multiple times or even running it once. Does FENICS have a large amount of randomness that could effect this? Also, if I keep on increasing the amount of iterations I am noticing that the time isn’t linear. Is it known how that scales up?

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [June 12, 2022, 3:40pm UTC](https://fenicsproject.discourse.group/t/performance-with-jit-for-fenics-and-or-fenicsx/8523/2 "2022-06-12T15:40:53Z")

</div>

You cannot turn of JIT if you are using the Python-layer of DOLFIN/DOLFINx. However, there are several things you can do to minimize the time JIT takes.

1. Make sure that your variational form only need to be compiled once, as shown in:  
[Out of memory error in frequency for loop - #4 by nate](https://fenicsproject.discourse.group/t/out-of-memory-error-in-frequency-for-loop/8371/4)  
and  
[Reassign scalar value within for loop - #2 by dokken](https://fenicsproject.discourse.group/t/reassign-scalar-value-within-for-loop/3455/2)

> [@zitterbewegung](#):
>
> Does FENICS have a large amount of randomness that could effect this? Also, if I keep on increasing the amount of iterations I am noticing that the time isn’t linear. Is it known how that scales up?

Without a minimal example illustrating this behavior, it is hard to explain why you are experiencing this. As DOLFIN is a very flexible tool, it allows the user to do things in many ways, and all of them are not always efficient.

As a final note, the time to compile code has been reduced in DOLFINx. You can also add more control to the compilation, see:  
[https://jorgensd.github.io/dolfinx-tutorial/chapter4/compiler\_parameters.html](https://jorgensd.github.io/dolfinx-tutorial/chapter4/compiler_parameters.html)

---

<div class="post-metadata">

**Author:** ![zitterbewegung](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/zitterbewegung/32/3883_2.png) [@zitterbewegung](https://fenicsproject.discourse.group/u/zitterbewegung)\
**Post date:** [June 16, 2022, 7:34pm UTC](https://fenicsproject.discourse.group/t/performance-with-jit-for-fenics-and-or-fenicsx/8523/3 "2022-06-16T19:34:35Z")

</div>

Also how do the computations scale when increasing the samples? We tried a simple differential equation and it wasn’t linear. Or does this depend on many factors?

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [June 16, 2022, 8:01pm UTC](https://fenicsproject.discourse.group/t/performance-with-jit-for-fenics-and-or-fenicsx/8523/4 "2022-06-16T20:01:54Z")

</div>

Everything depends on how you code up your problem. Without an example of how you have created your variational forms, I cannot give you any concrete advices on why you are not seeing linear behaviour.
