Programming

The Slowest Modern Programming Languages

And the reasons as to why they are slow

Image for post
Image for post
Photo by Karl Ibri on Unsplash

Programming languages have been out there for decades. Each language is built to satisfy a certain need.

As of today, the world counts about 700 notable programming languages. While about 250 managed to stay afloat, the rest was dumped by the programming community. (Latest data from Wikipedia)

Performance has been always an alarming matter for programmers. While before, execution time could be measured in calendars, nowadays, it is measured in fractions of seconds. Credits go to advancements in electronics.

The speed rate by which computers evolve follows Moore’s law:

Image for post
Image for post
Moore’s law. Source: Wikimedia

In electronics, speed and performance translate to the number of transistors a particular chip can have. The number surprisingly doubles every two years according to Moore’s law. That’s why your hand-sized mobile phone is way faster than a room-sized supercomputer of the 1990s.

When it comes to computer science, there is a difference between a faster code and a faster PC. A slow program and a slow computer.

I bet our friends at Intel and AMD are doing a great job creating powerful computing systems in terms of speed. Creating robust and fast programs is, therefore, up to us.

One of the things to take into account while creating software is language expectations. Each language is implemented differently, so each one delivers on its proper merits. And speed might simply not be among these merits.

Now, if you’re trying to build a program that would carry out demanding tasks such as games and heavy mathematical computations, you’d better steer clear from slow programming languages.

Generally, programming languages are two types:

  • Statically-typed programming languages
  • Dynamically-typed programming languages

Statically-typed languages are usually , meaning a program called the parses and converts your entire English-like code to assembly language and produces a new file. This file, in turn, is executed manually by the user.

Dynamically-typed languages are usually , meaning a software — analyzes and runsthe code in a line-by-line fashion.

Most of us like dynamically-typed languages. The languages that are less error-prone and interpreted easily by the human such as Python. But this comes at a cost. Speed.

In this post, we will lay down the relatively slowest common dynamically-typed programming languages.

Perl

If you used UNIX before, it is highly unlikely that you haven’t seen a Perl script. The majority of UNIX files are in Perl.

Perl is a Unix scripting language. It was created to mitigate the hardship programmers have to endure coding lengthy Shell programs. It is simply a bunch of Shell commands stuffed into a file.

More importantly, Perl came to ease the tasks that were considered a nightmare to accomplish in C and the other Unix languages. Of course, C wouldn't accept to be overtaken without paying the price.

As it was, Perl was taxed speed wise.

Additionally, finding a great Perl programmer these days is like trying to find a needle in a haystack. This is because, unlike Python, for instance, Perl is pretty sensitive to implementations and every operator should be in the right place to have a relatively efficient program.

Even with the most efficient implementations, Perl still stumbles behind its high-level programming languages counterparts. Yet, it’s still growing and efficiency problems are being solved one after one especially after Perl 6 release in 2019, which was named Raku.

PHP

PHP is a scripting web development programming language and usually complements HTML, CSS, and MySQL in website deployment.

Many argue that PHP is obsolete. But the truth is: IT IS NOT!

w3techs said :

On top of that, the recent 2020 StackOverflow survey on programming, scripting, and markup languages showcased PHP as a perfectly alive language toping both C++ and Typescript:

Image for post
Image for post
Source: StackOverflow 2020 survey.

However, Because PHP has a gradual learning curve and cheap to host, it takes damages in terms of performance.

PHP is incredibly slow because of the lack of just-in-time compilation (JIT compiler) and the fact that it is a dynamically-typed language. Fortunately, on November 26, 2020, PHP 8 came out with a performance optimization feature: a built-in JIT compiler.

The built-in JIT compiler helped PHP draw nearer to the programming languages of its class in terms of speed and performance.

Ruby

Yukihiro Matsumoto, the official author of Ruby and known as Matz in the Ruby community, said:

Ruby is an objected-oriented programming language. Everything is interpreted as an object. This has made it an elegant and easy tool to work with. Wave the wand and, your task is completed.

However, in terms of performance, Ruby is a typically interpreted language. Because interpreted languages run the code statement by statement, they tend to be slower compared to languages that use compilers.

Ruby takes another hit in terms of speed from the Global Interpreter Lock (GIL). This means that the language allows one thread at a time to use the GIL.

Lastly, Ruby also suffers from high memory consumption and slow garbage collection.

Python

The versatile Python has recently ranked 1st as the most popular programming language according to multiple sources such as statista and The Economist. It is heavily used in data science, web development, and cybersecurity.

Needless to flatter Python on this occasion as its benefits clearly outweigh its drawbacks. But as things stand now, most Pythonistas are allergic to speed. Yes, Python, unfortunately, is haunted by speed.

Python and Ruby are members of the same family. They are both slow because of the GIL and the fact of using an interpreter. The main difference between these two is that the former is data science-oriented while the latter leans more towards web development.

However, Python is backed by its powerful libraries and functions. And some of these libraries and functions, like the Numpy module and Filter() built-in function, are implemented in C++ resulting in a significant boost in terms of performance. That’s why Python is booming these days overtaking its fellow programming languages.

Takeaway

While speed and performance are important factors to take into account when it comes to software implementation, the blame should not be put on the programming languages alone.

Indeed, the root cause of major speed and performance issues is poor implementations and bad code design.

Image for post
Image for post
Source: Twitter

Ultimately, despite dynamically-typed languages being slow they provide promising language experience as well as pump up productivity. So, coding is never boring.

Better Programming

Advice for programmers.

Sign up for The Best of Better Programming

By Better Programming

A weekly newsletter sent every Friday with the best articles we published that week. Code tutorials, advice, career opportunities, and more! Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Mohammed Ayar

Written by

Engineer | AI Enthusiast | Content Writer | Voracious Reader

Better Programming

Advice for programmers.

Mohammed Ayar

Written by

Engineer | AI Enthusiast | Content Writer | Voracious Reader

Better Programming

Advice for programmers.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store