Answer the question
In order to leave comments, you need to log in
What language is useful to learn to understand modern programming languages?
Let's say I want to understand why one array iteration method is more efficient than another. Of course, I can measure the speed and just use the fastest one. But still I would like to understand this in advance.
Also I will be glad to links to recommended resources for studying.
Answer the question
In order to leave comments, you need to log in
I would like to understand this in advance.
It is not necessary to learn languages, but the basics of programming - algorithms, data structures ...
The speed of enumeration of an array depends on the implementation of this enumeration in the language itself. The speed reduction may be due to some amenities. For example, in Lua (a scripting language), iterating over an array is very slow, because there each array is a hash table with all the consequences. That is, this is not just a search for an element by index in memory relative to the beginning of the array in memory, it is also hashing each key, and searching by hash, and if there is a metatable (analogous to the prototype in JS), then additional checks for element access overload.
Perhaps you should learn about the architecture of the computer, in particular the x86 processor and memory, and how they are related. The closest language to dive into all this is assembly language, obviously. If you are interested in the speed of the language (which, by the way, is not critical for many tasks), then you need to look at high-speed compiled languages \u200b\u200b- C, C ++, Rust, D, Go, as well as close to them in speed through VM - C #, Java (Kotlin). Highly specialized Swift types can be omitted if you do not need them for solving problems. But even in scripting languages (JavaScript, PHP) it is now very good with speed. See also what JIT is, you will also be surprised if you have not heard it before.
In general, you need to start not from the universality of the language in terms of speed, but from the problem being solved. Because languages have different pros and cons, and an adequate scope. Some lose in speed, but have other advantages - convenience, documentation, reliability, compilation speed, community, development and debugging tools, popularity, and sometimes even the ability to use only this language in a particular area. For example, in the browser, whatever one may say, you will have to do it with JS (without perversions), and some shaders are generally written in separate languages, about which little is said.
Python is best at the beginning, so as not to bother with language features like in C ++ and java, and think only about the task, not about how to write it!
Let's say I want to understand why one array iteration method is more efficient than another.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question