O
O
ork8212019-11-04 21:13:41
Programming
ork821, 2019-11-04 21:13:41

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

6 answer(s)
R
res2001, 2019-11-04
@res2001

English

L
longclaps, 2019-11-04
@longclaps

I would like to understand this in advance.

There are no royal ways in mathematics. And not only in mathematics.

D
Developer, 2019-11-04
@samodum

It is not necessary to learn languages, but the basics of programming - algorithms, data structures ...

D
dollar, 2019-11-04
@dollar

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.

A
Andrey38287512, 2019-11-06
@Andrey38287512

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!

I
index0h, 2019-11-09
@index0h

Let's say I want to understand why one array iteration method is more efficient than another.

Knowing different languages ​​will not give you an understanding of what O is and an understanding of the theory of algorithms.
The fastest is the level of hardware, all sorts of hardware description languages ​​for FPGAs, assemblers, etc. Without proper preparation, you will not even be able to use it.
It is worth chasing speed only when it is a critical task for a business; moreover, optimization through an algorithm sometimes does not make sense.
Example: you have a small website, on some kind of hosting thread for one and a half dollars a month. On New Year's Eve, the site does not cope. The correct option in such a situation is to move to hosting for two or three bucks a month, and then, in which case, return back.
Your question is fundamentally wrong. A language is a tool for a specific area of ​​tasks, by learning it you will understand how to solve problems in this area. Understanding abstract modern languages ​​in a vacuum won't do it.
Understanding abstract modern languages ​​in a vacuum arises when understanding tasks and their solutions in the field of the purpose of a particular language.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question