First Impressions of Rust

Today I finished my first program written in Rust 0.10.  As with my article on Dart earlier this weekend I’m going to rely on Wikipedia for short intro for what Rust is.

The goal of Rust is to be a good language for the creation of large client and server programs that run over the Internet.[13] This has led to a feature set with an emphasis on safety, control of memory layout and concurrency. Performance of safe code is expected to be slower than C++ if performance is the only consideration, but to be comparable to C++ code that manually takes precautions comparable to what the Rust language mandates.[14]
Wikipedia

My first Rust program followed the same pattern that some of my other coding exercises have followed, that is implement an N-Queens puzzle solver.  While not terribly complicated, the puzzle does force an introduction to several important aspects of the language.  Since this was my first take on Rust, I am sure that my implementation isn’t great.
I found Rust to be an interesting language.  One of the more interesting opinions I developed about it was that it really prevents developers from doing something stupid.  That’s probably why it gets high marks for safe, concurrent code.  If I were to compare Rust to any other languages, I would say that it is syntactically similar to Scala and C++.  The strictness of the compiler does make learning the language a little more tedious than some other languages, but nothing that can’t be overcome.  I am probably a little biased on that point too since I’ve been writing a lot of Python lately.
On performance, I did noticed that it was about 60% faster than a architecturally similar python n-queens script I wrote.  I guess that’s not entirely unexpected from a compiled language.  I really want to figure out Rust’s threading capabilities.  That should greatly improve performance of the puzzle even more since it parallelizes well.
Rust has some serious potential and I predict as the language progresses, we will see more apps being written in it and more libraries available for it.  I for one will be continuing to tinker with finer details now that I have this program done.
Links:

1 Comment

Leave a Reply