+ 1

High level Language or Low Level Language?

Hello everyone, Am a begginner programmer in Python, I heard that Python programs are way shorter than C++ or other low level languages but when it comes to performace it beats python, I want to know that how does that happen actually bcz if a program take 10 lines in Python it will take 100 in c++ so the software created using it, it's size will also be more so why is C++ programs more faster? And will it be larger in size than Python or smaller? Am not sure

11th Jun 2020, 2:07 PM
Mouhurtik Ray
Mouhurtik Ray - avatar
6 Respostas
+ 2
It's true that python codes require less lines than C++ codes, but this does not mean that it is faster. The performance of a program cannot be measured in number of lines, but in involved software layers. Python involves an interpreter and - among others - a garbage collector service, so it is slower than C++. Regarding the size, if you build an all-included executable with Python - using PyInstaller - it will be bigger in size than a C++ executable. And even the size is not a good criterion to test the compactness of a program. For example an executable written in C# will be very small, but it will load an huge amount of dynamic libraries (the DotNet libraries), interpreter included, so it will be slow and fat - in terms of memory occupation.
11th Jun 2020, 3:50 PM
Bilbo Baggins
Bilbo Baggins - avatar
+ 2
I would like to ask you with c ++ for (int x = 0; x < 10; x++) cout << x << endl; but it still does not change the meaning. I have always considered c ++ as something between a high-level and a low-level programming language. As for me, it is closer to assembler.
11th Jun 2020, 6:21 PM
Alexander
Alexander - avatar
+ 2
Every Developer promotes his language by fancy terms such as "generates faster code",etc. High-level and low-level depends on their usage. For example, To a hacker C is a low-level(low detection), To a programmer C is a high-level(OS) language. TIP: Don't believe in Myths, Try it yourself!!!
11th Jun 2020, 10:15 PM
DEATH128
DEATH128 - avatar
+ 2
Because hardware interaction of C++ is faster then python. For eg. C++ uses compiler and python uses interprer and interpreter executes code line by line fashion, it takes more time.
12th Jun 2020, 5:23 AM
Bibhash Ghosh
Bibhash Ghosh - avatar
+ 1
c ++ language is lower level than python or java. But this does not mean the lower the language, the worse it is. So to speak, they are closer to the machine code and the more you need to interact with the hardware of your computer, and therefore you need more lines of code.
11th Jun 2020, 2:48 PM
Alexander
Alexander - avatar
+ 1
yes, but in c ++ you need to clear the allocated memory, unlike other programming languages. They have garbage collectors. Relatively fast, there are special libraries (I don’t remember exactly which ones) that will help reduce the size of the project and thus they can increase productivity.
11th Jun 2020, 4:40 PM
Alexander
Alexander - avatar