High level Language or Low Level Language? | SoloLearn: Learn to code for FREE!

+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

6/11/2020 2:07:39 PM

Mouhurtik Ray

8 Answers

New Answer

+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.

+2

@Alexander, I used printf() just to demonstrate the similarity with Python's print() function. cout is an object not a function. C++ does have low level functions but since it has oop it can be considered a high level language, unlike C which is a medium level language with low level features. I suppose the term is relative. "When I was a lad" C was considered a high-level language. Well compared to assembly language it was! These days I suppose if it doesn't have an automatic garbage collector it's not regarded as high level by the "youngsters".

+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!!!

+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.

+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.

+1

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.

+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.

+1

Why do you think C++ is more verbose than Python? Python: for x in range(0, 10, 1): print(x) C++: for (int x = 0; x<10; x++) printf("%d ", x); I wouldn't consider C++ to be a lower level language than Python.