How to Make Your Programs Run Hundreds to Thousands Times Faster Without Giving up Reliability and Ease of Programming
D programming language is the newest and the only technology that is both:
- high performance
- rapid development
High performance means that your software is expected to load at least about 10 times faster (for SSD disks) and run hundreds to thousands of times faster than most modern software and also use much less memory and produce less heat at the CPU.
Rapid development means that you do the project quickly. D programming is as easy for experienced programmers as Python or Ruby programming, if not easier thanks to higher reliability (see below) and thus less time to debug.
Reliable means that you use no less (maybe more) reliable technologies than in the atomic powerplant that powers your house and nuclear rockets and airplanes, not what other developers do.
Frequently Asked Questions
How can it be thousands of times faster?
- D compiler produces directly CPU machine code, not an intermediary code.
- D programming language is a statically typed language (see below).
These two features together allow programs to run hundreds to thousands of times faster.
Which reliability features D has?
- strict identifiers
- static types
- both dynamic and static asserts
- type traits checking
- automatic memory deallocation
- no pointer arithmetic when unnecessary
- array range checking
- complex program logic checking at compile time
What are the advantages of D?
- advanced programming language (not less than to say Python or Ruby) allowing to easily solve almost all kinds of programming problems
- very high speed (on par with C, C++, Ada, Rust)
- reliable (not worse than Ada, comparable with Rust)
- the reasoning at compile time
Is D the very best programming language?
Yes as of 2019. (Well, some people would argue that Rust is better.) Well, almost, D isn’t the best tool for proving the correctness of math theorems, in all other applications which I know D is the best one.
Is D open source?
What are the debug and release modes?
In D there are basically two modes of created software: debug and release. Debug mode may be a few times slower, but release mode software may crash randomly in the case of errors rather than shut down the program more correctly. It is your choice, what you need more: reliability or speed.
Static vs dynamic typing
Programming languages are of two categories:
- statically (or what is the same strongly) typed
- dynamically typed
The distinction is that in a dynamically typed language a variable can hold any object (and moreover the type of the variable can change while programs run), while in a statically typed language a variable can hold only an object of a certain type.
At first, it seems that dynamic typing makes programming easier, but it comes at a high cost:
- Programs in dynamic languages work much slower and use more memory. Moreover is too hard to write an optimizing compiler for a dynamic language, so programs work even slower.
- Dynamic languages don’t check value types what makes it very easy to make an error. Probably more than 50% of all programming errors are a wrong variable type in a dynamic language. Beware of unreliability.
In the past most languages used were static. It is understandable: Computers were slow and they needed fast languages.
In recent years dynamic languages gained popularity because they make programming easier.
But recently there was an unnoticed revolution: It was created D programming language, a static language which is as powerful (if not more) as dynamic languages. Now nothing prevents you to have both: high speed and reliability as well as a language with powerful features easy to use, to write short, understandable programs.
Dynamic languages now should mostly go to history. D is better.
Dynamic typing explained
Static typing is mostly simple: After compilation, a variable is either a word (such as a 64-bit integer) in computer memory or a group of nearby words or a set of such interrelated objects.
To make it even faster, variables can often be stored directly in a CPU register rather than in RAM.
Dynamic typing is more complex to implement (and it is, therefore, slower): A variable consists of:
- a memory word specifying its type (remember, in a dynamic language a variable can have multiple types and even change its type)
- a pointer to a memory location where the variable is placed
- a word or sequence of words holding the actual value
You see, it takes more memory. But the main problem is that memory for the variable value needs to be allocated/deallocated (and it is a slow operation) while the variable is created, changed, or destroyed. Almost every operation requires memory allocation. Also, as I said above the complexity of doing this prevents optimizing the program to make it fast. For example, we cannot store a dynamic variable in a CPU register. This is the reasons why dynamic is sometimes hundreds or thousands of times slower.