# JIT issues relevant to realtime applications

**URL:** <https://discourse.julialang.org/t/jit-issues-relevant-to-realtime-applications/67736>\
**Category:** New to Julia\
**Tags:** performance, jit, c\
**Created:** [September 6, 2021, 7:30am UTC](https://discourse.julialang.org/t/jit-issues-relevant-to-realtime-applications/67736 "2021-09-06T07:30:25Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 7, 2021, 4:41pm UTC](https://discourse.julialang.org/t/jit-issues-relevant-to-realtime-applications/67736/22 "2021-09-07T16:41:06Z")

</div>

My point with “people prefer Julia for hard-real-time” is that it’s possible. Mindshare may be missing. Games, which as (soft) real-time, are also possible, I didn’t say easier than with C#, I meant basically no huge road-block.

You can precompile Julia code already, and not use runtime code generation. Getting rid of the LLVM as a dependency is only about distributing smaller binaries. Julia as is isn’t that large compared to huge games…

> [@anon56330260](#):
>
> This is incorrect. […] For example, they support `stackalloc` keyword to force stack allocation.

Interesting, while possibly not always. Julia stack allocates by default, since Julia 1.5, for isbits types. It’s likely `stackalloc` in C# is implemented by alloca (non-portable in C), \_alloca, or \_malloca, then possibly not stack-allocating. [Dos and Don'ts of stackalloc](https://vcsjones.dev/stackalloc/)

For [\_malloca | Microsoft Learn](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?view=msvc-160)

> If _size_ is greater than **\_ALLOCA\_S\_THRESHOLD** , then **\_malloca** attempts to allocate on the heap, and returns a null pointer if the space can’t be allocated.

For C: [C Language Tutorial =\> alloca: allocate memory on stack](https://riptutorial.com/c/example/28419/alloca--allocate-memory-on-stack)

> Do not use `alloca()` in new code

In Linux: “The **alloca** () function is machine- and compiler-dependent.”, additionally in FreeBSD: “its use is discouraged.” Rust has at least two libraries: [stackalloc — Rust library // Lib.rs](https://lib.rs/crates/stackalloc)

> [@anon56330260](#):
>
> But other parts like network, GUI will be another story.

Games make their own “GUI”. I’m not aware of missing support do get graphics to the screen (at least for something comparable to Minecraft), and even if something is missing you can reuse C++ code to do that. I agree access to major game engines would be a plus, but you can do 3D only with Julia.

> **[GitHub - JuliaMultimedia/CSFML.jl: Julia bindings for CSFML](https://github.com/JuliaMultimedia/CSFML.jl)**
>
> Julia bindings for CSFML. Contribute to JuliaMultimedia/CSFML.jl development by creating an account on GitHub.

> It provides access to windowing, graphics, audio and network.

I’m not saying writing shaders is better in Julia (than e.g. C#). I doubt it, but it’s possible (or use C++ with):

> [@Writing GPU Shaders in Julia](https://discourse.julialang.org/t/writing-gpu-shaders-in-julia/60669):
>
> I was going over the [GLAbstraction tutorials](https://github.com/JuliaGL/GLAbstraction.jl/tree/master/tutorials) to learn how do do simple animations on the GPU, and things work fairly well. One pain point, however, is that the shaders needs to be written in a special language, meaning that they clash with the rest of the code. Is it possible to compile shaders from julia code? Rust has [rust-gpu](https://github.com/EmbarkStudios/rust-gpu), but I could not find anything similar for Julia.

---

_[View the full topic](https://discourse.julialang.org/t/jit-issues-relevant-to-realtime-applications/67736)._
