How does Julia compare with Nim, Go and Crystal for Artificial Intelligence?

Hello, I’m new to programming and I considered these languages. Firstly I choose Julia as it is simple and said it’s built for computing specifically. But when compared with other languages like nim it is slower in that area. Is Julia becoming general language?

But julia is general purpose programming language.

4 Likes

what is slower?

Julia has always been. If you think Python is general language (it is a glue in reality), then Julia is no less general.

4 Likes

It is slower when calculating digits of pi, matrix multiplication(by some tests) and this one: https://lh3.github.io/2020/05/17/fast-high-level-programming-languages it shows that nim and crystal are both faster.
For the general language part, I don’t really know what I meant by that, guess I just did too little research.

these are examples of highly optimized (down to assembly code) subroutine, there’s not reason to think Julia should magically be faster.

I don’t know what that bio stuff benchmark is doing, see:

but there are plenty of examples where Julia is faster than X:

And finally, the point is not “Julia is always faster than everyone in any cases no matter what”, that’s just impossible. Also it doesn’t matter, hell, if python is just 10x slower in almost all cases, say, compare to today’s Julia. we won’t need millions of lines of code for Numpy Numba and numerous C/C++ code piles on top of each other and Julia may never be invented in the first place.

To this end, I don’t see how Nim, Go, Crystal, Rust are replacement: there’s not enough user (think grad students in science who never took formal training in CE) facing high level library and scripting ability.

3 Likes

@jling has already linked the FASTQ parsing discussion, so all I’ll say here is that Julia is the only language mentioned here which gets anywhere near to optimized native matmul performance on CPU and GPU. You might have microbenchmarks of naive implementations in Nim/Go/Crystal, but to my knowledge none of them have tried a realistic performance comparison.

But back to your original question: how does Julia stack up for “AI”? Well, it’s not even close. Ecosystem-wise, Julia wipes the floor with the other 3 languages for almost every subfield of “AI” you can think of. Frankly, Nim is the only one that has any claim of being a decent language for ML, as the other 2 have a mostly non-existent ecosystem there. As a point of comparison, how many other languages (excluding Python and C++, of course) have pulled off something like GitHub - jonathan-laurent/AlphaZero.jl: A generic, simple and fast implementation of Deepmind's AlphaZero algorithm.? I’m not even going to mention SciML because that would be like bringing out the steel chair when your opponent is already on the ground :smile:

7 Likes

Thank you all @jling, @ToucheSir, and @Tomas_Pevny for your help in considering me to use julia. I just have one last question - is Julia going to get even more optimized for AI and ML. Do you think that nim has a chance?

How does Julia compare with Nim, Go and Crystal for Artificial Intelligence?

IMHO:
check and compare the number of AI/ML/AD-related :

3 Likes

To your first question, absolutely. Julia ML is growing pretty rapidly, and I see no reason for that progress to stop any time soon. Many core compiler improvements have been driven by or directly affect ML libraries, so there’s a good feedback loop in place too.

To your second question, any general-purpose language has a chance to be useful for ML. Theoretically, there should be no hard bounds on Nim’s performance (c.f. Elixir Nx, which is completely constrained by FFI and performance of libraries written in another langauge), but (much like you’d compare Python to Julia) Julia’s ML ecosystem currently has an order of magnitude more users, contributors and real-world deployments. I think this social aspect is often discounted in language comparisons, but it really is one of the most important factors in making a language viable for a particular application domain.

2 Likes

NimConf was held yesterday. From the titles I could spot 0 talks about artificial intelligence, machine learning, or any other topic even loosely related to scientific computing in general.

4 Likes

Okay, thanks you’re right. Julia is the right choice for scientific computing and everything with AI. Hope that will be its primary focus forever. I can’t see any other language having soo many AI / ML related packages and people focus on it. But really the last thing or two. Is TensorFlow.jl the same as the python version(does it have all the features). And how would you go about doing reinforcement learning in julia?
Thanks in advance Julia community, especially you for answering my question.

I think that TensorFlow.jl is largely abandoned project, as most now use Flux or Knet. There is no reason why you cannot do RL with Flux and I guess some people do.

1 Like

There’s https://juliareinforcementlearning.org/