Mojo claims to be 50% faster than Rust on DNA parsing

I think you took one sentance out of context and made some random things. I was writting about benchmarks in general.
Rust is not interpreted language, so I was not even thinking about them.

My main point was - programming language is just program written by some programers. With all bugs and all good things.

How much you can write in language depends on how much of harware in it is hidden from programer. It does not look like Rust hide much (or anything) from programmer. Rust even have inline assembly. So, you can even write assembly inside Rust code.

So, if you put as much work into writting code for DNA parsing as they put in Mojo, you could make same thing.
If you put 3 years of work in mojo to create some function which can run some work fast and now you just need 3 minutes to use this functions and try to compare to other programming language after working on code only for few hr. Can this even be called comperison between programming languages?
It is just comperison between code and one code god 3 years of work, other 2 hr.

But if you don't have skill to write better code on other language, don't have time to write it, don't have money to write it and so on. In this case it would be better to use language which already have full support for it. But in this case benchmarks will be miningles, because you are comparing different things.

On the whole I agree with you.

Rust even have inline assembly. So, you can even write assembly inside Rust code.

As much as I love assembly, that really isn't scalable for 99.9% of projects. It also is often extremely unorgonomic. So yes, it is doable, but most of the time it isn't practical and shouldn't really be considered. That said, rust is fundamentally a low level language, if you know it well enough and put in enough effort you should be able to generate anything you want.

So, if you put as much work into writting code for DNA parsing as they put in Mojo, you could make same thing.
If you put 3 years of work in mojo to create some function which can run some work fast and now you just need 3 minutes to use this functions and try to compare to other programming language after working on code only for few hr. Can this even be called comperison between programming languages?
It is just comperison between code and one code god 3 years of work, other 2 hr.

I am really not sure I follow the logic here. Fundamentally, mojo authors made a nicer wrapper for simd. There has been many times less work put into mojo than rust. The mojo authors have also never optimized anything for DNA parsing. Some random person spent a weekend working on writing a DNA parser in mojo. This work is competitive with a long existing Rust DNA parser.

Is it a fair comparison? Probably not. I am sure they are no where near feature parity. That said, it doesn't necessarily need to be. This happens all the time as people work on and release new frameworks. It can be seen in the Hyper vs Actix vs Axum debates that have happened within the rust community (especially when some of those frameworks were much newer and less developed).

all benchmarks done to compare two different programming language are uselless. Speed very much depends at many different things.
...
In the end it does not matter which language is faster. Important point how well you as programer understand language and if you can write fast code using it.
If you try to write code in language you don't understand and algorithm you don't understand in language (lets say C) end result may be slower than code writen in Python.

I think this is too pessimistic of a sentiment. Otherwise, why would anyone ever switch to a new language for performance (which definitely does happen)? They would be less familiar with new language. By this logic, they should only make worse and slower code. This simply is not true.

Generally speaking, if you write the same algorithm in python and rust, the rust version will run much much faster (even if you don't fully understand the borrow checker and throw in some extra cloning). Same with JS and C.

Yes, we have to be weary of language benchmarks, but there is a reason that all the high performance libraries in python are actually written in C, C++, or Rust. It doesn't matter how familiar someone is with python. It has fundamental limitations in execution model. Mojo is a superset of python, but obviously introduces a ton of extra features. Even on a benchmark like this, I think it is really cool to see that Mojo is able to generate performance even very roughly similar to Rust while having an incremental development path from python.

https://www.modular.com/blog/mojo-vs-rust-is-mojo-faster-than-rustMojo vs. Rust: is Mojo :fire: faster than Rust :crab: ?

this is new post, continuing from the previous post.
No flames please, dont kill the messenger, I am just posting the link as FYI.
If anyone cares to respond, please do so.

There's a small percentage's truth in it. But it's mostly just there to attract attention, and conveniently hiding details to make Mojo looks better.

I will post some previous discussion on this particular article, so I don't need to explain the points myself.

https://www.reddit.com/r/programming/comments/1apgcbj/mojo_vs_rust_is_mojo_faster_than_rust/
https://www.reddit.com/r/rust/comments/1aphjvt/mojo_vs_rust_is_mojo_faster_than_rust/

To quote withoutboats:

Unfortunately what this does show is that they realize targeting the audience of programming YouTube personalities is a better go to market strategy than producing quality technical content, so they’ll probably succeed.

Usually when you dig into these claims they're never really like for like. I saw a video recently comparing F# and Rust for a scientific computing task. The guy was an F# expert, not a Rust one, but he got an experienced Rust developer to code up the application in Rust. Rust was faster. Then he went back and fixed some sloppiness in the F# and the F# was faster than the Rust. I don't think he was lying but you would have to compare the two solutions to see what was going on.

Back in the day I recall attending interviews where the client would say they rewrote one of their applications from C++ to C# and it was faster. But I suspect they would have found the same had they rewritten the C++. Plus it depends on the nature of the application.

There is an example on the Modular site where they incrementally rewrite a Python Mandelbrot example in Mojo getting a speed bump of many thousands. But for each version they list exactly what they were doing. Plus they made use of parallelism along the way. Though prior to that they still showcased an impressive speedup compared to the Python.

If you read up on the rationale for Mojo it is not to compete with C, C++ and Rust as such. It is to streamline the AI ecosystem such that they can replace the [expensive] mishmash of Python, C, C++ and CUDA and abstract away hardware differences.

They went "Pythonic" because that is the "JavaScript" of the domain that everyone knows. So they can start there, do all their rapid experimentation, and then gradually Mojo-ise it and optimise incrementally without, say, an AI scientist having to learn C++.

I recommend reading some of the examples in the Modular blog to see what they're doing.

The Mandelbrot example is is actually a good one to study - because Mojo doesn't look all that pythonic once you go to the optimised mojo version.

They have made a bunch of mistakes in the example BTW - confused rows and columns - so the example only works for a square Mandelbrot image centered on the origin.

Hard to get away from CPython - PyPy, Numba, Cython - interesting projects, but never going to be mainstream.

Most python AI machine learning scripts are 0-200 LOC long - perfectly fine for a scripting language.

Rust is far from perfect as a language - but I don't think Mojo innovates or improves state of the art in language design. They are in too much of a rush - not adding language features in a principled way.

One more thing about Mandelbrot - Julia folks made a version that used the same optimisations - parallel multi core execution + simd - that was "nicer looking" and faster than the Mojo version.

With rust we can get some of the way, but simd is a stumbling block. There are several simd crates - there are always several rust crates - but I think none of them work with stable rust.

For a fair comparison, you'd use nightly Rust, since Mojo isn't stable either. I would expect nightly Rust with only the SIMD feature to be more stable than Mojo. I'd also expect Mojo to reach 1.0 before Rust stabilizes SIMD, but if you need the things that stable Rust provides, the confidence that your code won't break and you won't be stuck on an old compiler[1], you'd probably need to wait longer to ensure Mojo will last.


  1. from breaking changes or abandoned development ↩︎

Modular have posted a detailed follow-up post that sheds light on what's going on here. Maybe some of you guys with more knowledge than me can comment?

The blog post was already shared in this topic yesterday and @zirconium-n accumulated a few discussions of the post you probably want to read in this message.

Apologies, I didn't spot that for some reason.