Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

creating a new document on your computercreating a new document on your computer, Summaries of Compilers

creating a new document on your computer creating a new document on your computer creating a new document on your computer

Typology: Summaries

2020/2021

Uploaded on 01/31/2022

codexspy
codexspy 🇵🇰

1 document

1 / 16

Toggle sidebar

Related documents


Partial preview of the text

Download creating a new document on your computercreating a new document on your computer and more Summaries Compilers in PDF only on Docsity! @ Article title: A Pragmatic Comparison of Four Different Programming Languages Authors: Saqib Ali[1], Sammar Qayyum[2] Affiliations: UMT[1] Orcid ids: 0000-0001-8533-4103[1], 0000-0001-5231-2936[2] Contact e-mail: 18013020009@skt.umt.edu.pk License information: This work has been published open access under Creative Commons Attribution License http://creativecommons.org/licenses/by/4.0/, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Conditions, terms of use and publishing policy can be found at https://www.scienceopen.com/. Preprint statement: This article is a preprint and has not been peer-reviewed, under consideration and submitted to ScienceOpen Preprints for open peer review. DOI: 10.14293/S2199-1006.1.SOR-.PP5RV10.v1 Preprint first posted online: 21 June 2021 Keywords: Programming Language UNIVERSITY OF MANAGEMENT AND ‘TECHNOLOGY, DASKA CAMPUS DEPARTMENT OF COMPUTER SCIENCE A Pragmatic Comparison of Four Different Programming Languages Professor: Authors: Mamona Mumtaz Saqib Ali Departament of Computer Science Sammar Qayyum A Pragmatic Comparison of Four Different Programming Languages 1.3 C++: C++ was designed and developed by Bjarne Stroustrup as an expansion to C. It was released in 1985, but in 1989 its newer version was released which added more advanced features while also adding error handling. It is a gencral-purpose program- ming language and is mostly similar to C with some key differences. It is a compiled programming language with a blend of both low and high-level features making it highly versatile. It supports full object-oriented programming, structures, unions, operator overloading and templates as well. It has full pointer support. 1.4 Python: Python was developed and designed in 1991 by Guido Van Rossum. It is an inter- preted programming language. It supports object-oriented programming. Programs written in Python are short and easier to understand and read because it is a high- level programming language with minimal low-level functions. One major positive point of Python is that it has a huge library support making it highly efficient in almost all fields like Artificial Intelligence, Web Development and Data Science just: to name a few. Since it’s an interpreted programming language, it is slower as com- pared to C and C++, but it supports features like Garbage collection and Dynamic typing. Python is also extremely popular due to being beginner friendly. 1.5 Java: James Gosling begin the work on Java in 1991 and after a steady development and design procedure released it in 1996. Java is an object-oriented simple and portable programming language developed at the Sun Microsystems lab. syntax is equitable to C++ with some major differences in the language itself. It is both a compiled and interpreted programming language with support for garbage collection. Some of the features missing are the absence of structures and unions both of which are present in C++, support for pointers is also limited in Java. One more major difference is that it is a “Write Once Run Anywhere” language because of JVM support. 2 Methodology: Since Programming is all about speed and efficiency, our focus in the paper will be on the quantitative side of things with a little sprinkle of qualitative evaluations and conclusions as well. A Pragmatic Comparison of Four Different Programming Languages 2.1 Language Versions: Compiler Version TDM GCC 4.9.2 TDM GCC 4.9.2 Java SE 16 Python 3.8 2.2 Hello World in Four Languages: In Python: print("Hel In Java: HelloWorld { static void main(String System.out.printin( "Hel A Pragmatic Comparison of Four Different Programming Languages Inc: #include <stdio.h> int main() { printf In C++: #include <iostream> As it can be witnessed from the above programs: C, C++ and Java’s hello world program has exactly 5 lines of code whereas Python’s hello world program has a single linc. This simple example can point us in one direc tion that C, C++ and S programs will bee ome much longer the bigger the Proje Python’s mere Jav A Pragmatic Comparison of Four Different Programming Languages We ran the experiment exactly 5 times for cach language and its program and then the average results are calculated and displayed in the above table. The experiment presents us with some intcresting information, like Python had two more lines of code then Java, which made it the 2ND in our experiment on the number of lines and surprisingly Java had the least number of lines with C and C++ having an equal number of lin expected. C had the least CPU usage with C++ only falling behind it by about 8%. Python had the most CPU usage as expected because it’s interpreted whenever the code is running. Java on the other hand had about 2 percent less CPU usage then python. The execution time presented us with a big disappointment from Python as it took a whopping 2900 MS (or 2.9 seconds) to perform the calculations, showing us that if speed is a factor (which is a huge factor) then you are better of to picking something else like C which had the least execution time with C++ on the 2ND place with only a negligible difference and once again Java sitting comfortably in the middle with about 69 MS more execution time then C which is still quite less as compared to Python. From the experiment we can conclude that, if speed is of importance then C, C++ or Java should be chosen, however, if speed is not of importance and rather the handling and less complexity of code is the priority, then Python can be favored instead. A Pragmatic Comparison of Four Different Programming Languages 2.4 Experiment 2: For experiment 2, we choose to do large matrix calculations. The size of the matrices was kept 1024 x 1024 and random values were assigned to them from 0.0 — 1.0 (the effect of random values has no effect on the results). The experiment was conducted 5 times for cach language and the average was calculated. When the results for the languages were out, we were confused at first because Java’s program ran faster than C and C++, but then we realized that Java and Python’s compiler by default performs optimizations, keeping this in mind, we turned towards our C/C++ compiler and used the “03” optimization flag, and the results were quite shocking, the optimization flag not only gave the lead to C and C++, but it also widened the result’s gap by a large margin as scen from the Table: Running Time (In Seconds) Iteration Table: Experiment 2 (de ea) Language OES IC LP) Iteration 1 17.03 19.33 436.06 11.98 3519 3511 Iteration 2 17.08 19.33 438.93 11.93 3.507 3.493 Iteration 3 17.13 19.36 435.33 12.11 3.503 3490 Iteration 4 1706, 1922 36.15 1206 3508 3496 Iteration 5 41703 1943 3801 1190 3514 3488 Average 1706, 1933 436.89 1199 3510 3495 A Pragmatic Comparison of Four Different Programming Languages CPU Usage % Iteration Table: Experiment 1 ET TET C/C(-03) | C++/C++(-03) UT Java Iteration 1 23 29 23 30 Iteration 2 23 29 23 30 Iteration 3 29 29 23 30 Iteration 4 23 29 23 30 Iteration 5, 23 29 23 30 Average 23 29 23 30 10 A Pragmatic Comparison of Four Different Programming Languages References {1] K. Aldrawiesh, A. Al-Ajlan, Y. AlSaawy, and Abdullah Bajahzar. A compara- tive study between computer programming languages for developing distributed systems in web environment, 11 2009. {2} Zakaria Alomari, Oualid Halimi, Kaushik Sivaprasad, and Chitrang Pandit. Comparative studies of six programming languages, 04 2015. {3] Codclani. How many programming languages are there in the world?, Nov 2017. {4) Ronald Garcia, Jaakko Jarvi, Andrew Lumsdainc, Jeremy Sick, and Jeremiah Willcock. An extended comparative study of language support for gencric pro- gramming, 03 2007. 13
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved