When I was a young 12-year-old in the early 80’s, I was fortunate enough to acquire a Commodore Vic 20, which was my first computer. From there, I graduated to the Commodore 64, which, even today, remains one of the most iconic personal computers of the 1980s. With its 8-bit processor and a minimal 64 kilobytes of RAM, it wasn't just a machine; it was a gateway to the digital frontier. I became obsessed with writing software for the Commodore. While writing software, I was also interested in making it faster. Between basic and/or assembler, depending on what you used, you could significantly increase the speed of the 6502 microprocessor that was internal to the Commodore 64.

A Brief Overview of programming languages

As we all know, Programming languages are tools used by developers to communicate instructions to computers. As there are many different languages, each language has its purpose. I chose to test some of the more popular languages today.

As I said, this list is just the tip of the iceberg. Each programming language has its unique features, strengths, and use cases.

Why run Speed Tests?

Running speed tests on programming languages I feel can be important for several reasons, especially in the context of performance-critical applications. As I said, I enjoyed doing this on the Commodore 64, trying to optimize code and make a program better. Today, arguably, it’s not as important as there are other factors to consider when building applications for business. Here are some key reasons to speed-test your programming language.

For example, if you're developing a high-performance web server, running speed tests on different languages like C/C++, Rust, and Python can help you decide which one offers the best performance and resource management. But as I said above, speed may not be the only deciding factor when choosing a development language such as,

Choosing a programming language involves more than just performance considerations. Here are some reasons you might choose a slower language.

However, this is a briefing about the speed of 6 different programming languages. So, let’s dive into what I found.

Performance Insights

Through speed testing, several interesting facets of each language came to light. The test that was used was a loop that iterated 1,000,000 times with no instruction set. I call it the “1MLT” speed test.

Conducted on (Machine Specs)

Language C

C is a sturdy foundation that many modern programming languages are built on. I actually started years ago in the C Language, and here are the reasons you may want to use C.

Language C#

C# is a versatile and powerful programming language developed by Microsoft. Here are some key reasons why you might choose to use C#:

Language RUST

Rust is a language that's been gaining a lot of attention for its focus on performance, safety, and concurrency. Here are some compelling reasons to consider using Rust.

Language PYTHON

Python is incredibly popular, and for good reason! It is actually my preferred language today.

Here are some top reasons to consider using Python.

Language NodeJS

Node.js is a popular choice for building server-side applications. Great if you already know JavaScript and has been around for some time. Here are some compelling reasons to consider using Node.js.

Language Java

Java is a widely used programming language that's renowned for its portability, scalability, and robustness. Great for building desktop applications, web applications, or mobile apps. Here are some key reasons to consider using Java.

Findings

As I figured when writing this code. C Code would be the most performant. But there were a couple of surprises.

The first one is Rust. It tested very slowly at first. I am new to the Rust programming language. I found that to be very strange, given the fact that it is specifically designed to be fast. So, I did some digging, and it turns out that the Rust compiler has optimization levels. So, it should be noted for anyone new to Rust that when you have production code, make sure you optimize it when compiling. I found it interesting that there was a massive speed difference between the Non-optimized code and the Optimized release code. So, I included it in the results.

The second surprise I had was Python tested very fast for being an interpreted language. From the tests I ran, it turns out that Python was the second fastest behind C. So i did some more digging and there are reasons that this may have occurred.

I would be interested in readers' thoughts if you would like to drop me a message: ([email protected])

Results Table

Results Table

Testing Results

Conclusion

Basically, I created this briefing as I enjoy writing and testing code in a variety of languages. Of course, there are many different variables that can affect the speed and responsiveness of an application. There are many different and distinct reasons to choose one programming language over another programming language. But in my mind, it comes down to two reasons. The first one is execution speed. Some languages, like C, C++, and Java, are renowned for their fast execution times, making them suitable for performance-critical applications such as video games or high-frequency trading systems.

The second one, and maybe the most important, depending on what you are building, is development speed. Higher-level languages like Python or JavaScript might not be the fastest in execution but often allow for quicker development and iteration, which can produce massive benefits for the enterprise software cycle. However, in this test, Python performed very well.

As a surprise, it turns out Python was faster than I thought, and Rust was much slower than I thought it would be. I really thought it would be closer to C. When you do these tests and find surprises, at least for me, it gives me the feeling of accomplishment through proof.

I really enjoyed writing and testing each different language. Knowing that each has pros and cons. Hopefully, this gives you a pretty good idea of which language you might be capable of and perhaps motivates you to do some of your own.

I appreciate your reading.

Craig Breakspear