# Should one use Julia to create libraries?

**URL:** <https://discourse.julialang.org/t/should-one-use-julia-to-create-libraries/125622>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 6, 2025, 1:38pm UTC](https://discourse.julialang.org/t/should-one-use-julia-to-create-libraries/125622 "2025-02-06T13:38:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cocoa1231](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cocoa1231/32/22215_2.png) [@cocoa1231](https://discourse.julialang.org/u/cocoa1231)\
**Post date:** [February 6, 2025, 1:38pm UTC](https://discourse.julialang.org/t/should-one-use-julia-to-create-libraries/125622/1 "2025-02-06T13:38:10Z")

</div>

I was browsing the thread on [why `LoopVectorization.jl` is deprecated](https://discourse.julialang.org/t/why-is-loopvectorization-deprecated/), and I came across [`LoopModels`](https://github.com/LoopModels/LoopModels), which is a successor to `LoopVectorization.jl`, and this made me wonder if one should be writing general purpose libraries in Julia (even if domain specific) or just go for C/C++/Rust/Zig or something like that.

For my specific use case: I’m working on a package currently for doing continuous time monte carlo simulations on Potts models, and I’ve not faced any issues thus far, but this is mostly for my own work. I would like to make this available as a package once ready, and I’m fairly certain that doing so in Julia would be good enough. But I’m not super experienced in developing widely used software, and a lot of my work is and will be in computational physics, so should I learn to develop my code in the aforementioned languages? So far I’ve been solely using Julia and I do love it, but I am just looking for anybody kind enough to share their opinion/experience.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [February 6, 2025, 2:21pm UTC](https://discourse.julialang.org/t/should-one-use-julia-to-create-libraries/125622/2 "2025-02-06T14:21:28Z")

</div>

I’d say that LoopVectorization is a _very unique_ sort of library. It’s effectively a compiler plugin — you’re explicitly asking for a particular _compilation_ strategy. The challenges there are quite unique.

There can be a tension between performant Julia and “friendly” Julia, but that’s a very different sort of problem than building the _tooling_ for maximum performance at all costs.

In any case — it’s great that you’re enjoying it and I’m glad it’s working for you!

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [February 6, 2025, 2:22pm UTC](https://discourse.julialang.org/t/should-one-use-julia-to-create-libraries/125622/3 "2025-02-06T14:22:44Z")

</div>

> [@Why is LoopVectorization deprecated?](https://discourse.julialang.org/t/why-is-loopvectorization-deprecated/109547/31):
>
> That’s fine for applications, but can be quite rough for maintaining a library that many other people depend on."

The context here is that LoopVectorization is not an ordinary library, but a library that attempts to do very low-level things with the compiler — basically to create a new compiler-optimization pass for other code. The argument was that, if you want to hook into the compiler at that level, you should really be interfacing with the compiler directly, rather than indirectly through Julia’s high-level language. And since our low-level compiler (LLVM) is written in C++, to access it directly you really need to be writing in C++.

I don’t think this applies to ordinary Julia packages/libraries (of which there are already many thousands).

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [February 6, 2025, 3:48pm UTC](https://discourse.julialang.org/t/should-one-use-julia-to-create-libraries/125622/4 "2025-02-06T15:48:13Z")

</div>

4 posts were split to a new topic: [Discussing quotes of DMs of thoughts of others on LoopVectorization](https://discourse.julialang.org/t/discussing-quotes-of-dms-of-thoughts-of-others-on-loopvectorization/125625)

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [February 6, 2025, 3:57pm UTC](https://discourse.julialang.org/t/should-one-use-julia-to-create-libraries/125622/5 "2025-02-06T15:57:20Z")

</div>

Not everyone in the world agrees about this stuff, and some people _do_ build things in julia and then decide to use other languages, and this can happen for a variety of reasons.

- Sometimes julia has a fundamental weakness in a specific area (or is just immature in that area)
- Sometimes the author of the package decides that they just don’t like julia as a language
- Sometimes there are issues of accessibility / sharing the library with certain key people that make it more attractive to use one language or another
- etc

On the other hand, there’s lots of projects that have started in other languages and then moved to julia. ITensors.jl for instance used to be in C++ and then moved to julia. The DifferentialEquations.jl stuff started out very early on in Matlab (if I recall correctly?) and then moved to julia.

Julia has real strengths and things to offer, especially for scientific numerical projects like the one you’re describing. If things are working out well for you currently, I wouldn’t worry about it too much. And if problems do come up, I think the community here would be more than happy to try and help you work through them!

Personally, I definitely wouldn’t want to do that kind of work in C++.

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [February 6, 2025, 4:01pm UTC](https://discourse.julialang.org/t/should-one-use-julia-to-create-libraries/125622/6 "2025-02-06T16:01:53Z")

</div>

For reference, here is what the ITensors.jl people [say on their website about the switch](https://itensor.org/faq/):

> **Why do you use Julia? Why have a Julia and C++ version?**
> 
> ITensor was originally written in C++ around 2010 before Julia was available. C++ was a good choice and continues to be an strong language for high-performance computing.
> 
> We ported ITensor completely to Julia to benefit from Julia’s high performance (it is a compiled language), its expressivity (it offers a robust type system as well as a dynamic, generic programming experience), while avoiding the common “two-languge problem” of using a slower interface language with a high-performance back-end language. The choice of Julia has been very successful for us and delivers both high performance and productivity. It is also easy to call Julia code from other languages such as Python.
