Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Performance comparison of Java and C++ when sorting integers and writing/reading files.
Blekinge Institute of Technology, Faculty of Computing, Department of Computer Science.
2019 (English)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE creditsStudent thesis
Abstract [en]

This study is conducted to show the strengths and weaknesses of C++ and Java in three areas that are used often in programming; loading, sorting and saving data.Performance and scalability are large factors in software development and choosing the right programming language is often a long process.It is important to conduct these types of direct comparison studies to properly identify strengths and weaknesses of programming languages. Two applications were created, one using C++ and one using Java.Apart from a few syntax and necessary differences, both are as close to being identical as possible.Each application loads three files containing 1000, 10000 and 100000 randomly ordered integers.These files are pre-created and always contain the same values.They are randomly generated by another small application before testing. The test runs three times, once for each file.When the data is loaded, it is sorted using quicksort.The data is reset using the dataset file and sorted again using insertion-sort.The sorted data is then saved to a file.Each test runs 50 times in a large loop and the times for loading, sorting and saving the data are saved.In total, 300 tests are run between the C++ and the Java application. The results show that Java has a total time that is faster than C++ and it is also faster when loading two out of three datasets.C++ was generally faster when sorting the datasets using both algorithms and when saving the data to files. In general Java was faster in this study, but when processing the data and when under heavy load, C++ performed better.The main difference was when loading the files.The way that Java loads the data from a file is very different from C++, even though both applications read the files character by character, Java’s “Scanner” library converts data before it parses it.With some optimization, for example by reading the file line by line and then parsing the data, C++ could be comparable or faster, but for the sake of this study, the input methods that were chosen were seemingly the fairest.

Place, publisher, year, edition, pages
2019. , p. 25
Keywords [en]
Programming, software, java, c++, performance
National Category
Computer Sciences
Identifiers
URN: urn:nbn:se:bth-18330OAI: oai:DiVA.org:bth-18330DiVA, id: diva2:1333653
Subject / course
DV1478 Bachelor Thesis in Computer Science
Educational program
DVGSP Game Programming
Supervisors
Examiners
Available from: 2019-07-26 Created: 2019-07-01 Last updated: 2019-07-26Bibliographically approved

Open Access in DiVA

BTH2019Sharma(532 kB)26 downloads
File information
File name FULLTEXT02.pdfFile size 532 kBChecksum SHA-512
90a31afb902890cc0341ff05dc7a50c80c9ffe77b762ad2e07684c34a1793f0dfec0150e42c5b48660261062311954c9e1cfcefe3c50a7b626b2aa6f37a35b2f
Type fulltextMimetype application/pdf

Search in DiVA

By author/editor
Sharma, Suraj
By organisation
Department of Computer Science
Computer Sciences

Search outside of DiVA

GoogleGoogle Scholar
Total: 26 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 94 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf