# PEP 744: JIT Compilation

**URL:** <https://discuss.python.org/t/pep-744-jit-compilation/50756>\
**Category:** PEPs\
**Created:** [April 12, 2024, 12:33am UTC](https://discuss.python.org/t/pep-744-jit-compilation/50756 "2024-04-12T00:33:50Z")\
**Posts on this page:** 1\
**Showing post:** 53

<div class="post-metadata">

**Author:** ![brandtbucher](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/brandtbucher/32/22862_2.png) [@brandtbucher](https://discuss.python.org/u/brandtbucher)\
**Post date:** [May 20, 2024, 6:14pm UTC](https://discuss.python.org/t/pep-744-jit-compilation/50756/53 "2024-05-20T18:14:49Z")

</div>

Great question. Honestly, the JIT may be a bit _too_ transparent right now, so there aren’t really any great APIs for this yet.

If you want to know if a `configure`-based build enabled the JIT, you can use `"_Py_JIT" in sysconfig.get_config_var("PY_CORE_CFLAGS")`.

If you want to know if a specific _function_ contains jitted code, this is currently what we do in internal tests:

```py
import _opcode
import types

def is_jitted(f: types.FunctionType) -> bool:
    for i in range(0, len(f. __code__.co_code), 2):
        try:
            _opcode.get_executor(f. __code__ , i)
        except RuntimeError:
            # This isn't a JIT build:
            return False
        except ValueError:
            # No executor found:
            continue
        return True
    return False

```

Here’s an example:

```pycon
>>> def fibonacci(n):
... a, b = 0, 1
... for _ in range(n):
... a, b = b, a + b
... return a
...     
>>> is_jitted(fibonacci)
False
>>> fibonacci(100)
354224848179261915075
>>> is_jitted(fibonacci)
True

```

This should help if you’re just curious, but if you’d like more robust/efficient APIs in `sys` or `dis`, then please open an issue letting us know what sort of functionality would be most useful to you!

---

_[View the full topic](https://discuss.python.org/t/pep-744-jit-compilation/50756)._
