Julia and C or just standalone C++

Hello, I was wondering if in production the pair Julia and C was a better option to C++ only. In terms of performance, and for code management in a large scale project. Thank you.

Please note that this is a Julia forum. So biased answers are to be expected.
Now that this disclaimer is out of the way, here are my 2c:
if your experience with all three languages is on par, I would opt for the solution that uses a single language. But why not just Julia?
Furthermore, I think you would do yourself a favor by also taking not only the performance of the code into account but also the speed of development. I, for myself, found it much easier to improve my code (and hence the performance of my code) in Julia than in the other mentioned languages.


Thank you. It’s okay, bias is priced in.

1 Like

IMHO there is not much point using C with Julia unless you have existing C libraries. It’s pretty easy to get Julia performance in the ballpark of C, and in some cases where additional type system information and @generated functions can help, faster than C is quite possible.

C++ is a matter of taste… but personally I’m 10x more productive in Julia than C++, and performance optimization is easier in julia, because the built-in tooling like @code_native is really good.


Ciao, “better option” dipende veramente da quello che vuoi fare… it depends on what you want to do, what are your skills, those of the people working with you (as you referred to a “large project”), which libraries do you need…

Given the bias noted by rudy79, I believe that with the exception of some embedded systems, new projects are nowadays almost all better off started in Julia (alone) than in C/C++…

Concerning code management the Julia way is to split large projects in many independent packages…


Thank you.

My two cents. For code management I would agree with others that sticking to 1 language is preferable to multiple languages. From a performance standpoint I’ve heard that C is “faster” than C++ but I believe the difference is minor. C will probably be the fastest in general unless you want to hand write assembly. C after all was suppose to be one step up from assembly, well maybe two steps up, there was B after all . :slight_smile:

That said I think the compiled languages build/designed in the last 10 to 20 years allow for faster development while giving you close to the performance of C. These newer languages are solving some of the headaches that C developers have been fighting forever. And unfortunately you can’t take away those headaches without some overhead.

All that said, I do like Julia and mostly recommend it. If your application takes a bunch of input performs some transforms on it, and spits out the results Julia is great. The only weakness I’ve run into with Julia is threading. What’s there works great, but there are some situations that currently Julia is not setup to handle without some work.

One area is handling asynchronous external input i.e. user input or network requests. It can be tricky to ensure that you have CPU cycles available to respond to those. A second area is getting full CPU usage if you have a collection of unrelated tasks that take differing amounts of time to complete. There are some libraries that help with these issues and I’m hoping as threading becomes more mature and finalized that these areas are addressed.