<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">JSEA</journal-id><journal-title-group><journal-title>Journal of Software Engineering and Applications</journal-title></journal-title-group><issn pub-type="epub">1945-3116</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/jsea.2012.58072</article-id><article-id pub-id-type="publisher-id">JSEA-21960</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject></subj-group></article-categories><title-group><article-title>
 
 
  Time Comparing between Java and C++ Software
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>s’ad</surname><given-names>Mahmoud Alnaser</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Omar</surname><given-names>AlHeyasat</given-names></name><xref ref-type="aff" rid="aff2"><sup>2</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Ashraf</surname><given-names>Abdel-Karim Abu-Ein</given-names></name><xref ref-type="aff" rid="aff2"><sup>2</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Hazem</surname><given-names>Hatamleh</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Ahmed</surname><given-names>A. M. Sharadqeh</given-names></name><xref ref-type="aff" rid="aff2"><sup>2</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib></contrib-group><aff id="aff2"><addr-line>Computer Engineering Department, Faculty of Engineering Technology, Al-Balqa’ Applied University, Amman, Jordan</addr-line></aff><aff id="aff1"><addr-line>Computer Science Department, Ajlun University College, Al-Balqa’ Applied University, Amman, Jordan</addr-line></aff><author-notes><corresp id="cor1">* E-mail:<email>asad1_99@yahoo.com(SMA)</email>;<email>omarheyasat@hotmail.com(OA)</email>;<email>ashraf.abuain@fet.edu.jo(AAA)</email>;<email>hazim-hh@bau.edu.jo(HH)</email>;<email>sharadqh_78@yahoo.com(AAMS)</email>;</corresp></author-notes><pub-date pub-type="epub"><day>28</day><month>08</month><year>2012</year></pub-date><volume>05</volume><issue>08</issue><fpage>630</fpage><lpage>633</lpage><history><date date-type="received"><day>May</day>	<month>11th,</month>	<year>2012</year></date><date date-type="rev-recd"><day>June</day>	<month>18th,</month>	<year>2012</year>	</date><date date-type="accepted"><day>June</day>	<month>27th,</month>	<year>2012</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  This paper construct a comparison between two main software’s used in programming applications that are Java and C++, the comparison operation includes the time needed to perform some algorithm i.e. speed of operation, flexibility to adjusting some code, and efficiency. The same code is used to compare between the two software to determine which one is better. It is found that C++ needs less time to execute the same code comparing with Java. Java needs about 10% excess time to execute the same code segment comparing to C++.
 
</p></abstract><kwd-group><kwd>Java; C++; Algorithm Speed; Code Flexibility</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>Java and C++ are the most used languages in programming for most of programmers and system designers. Java has a structure called an “Interface”. Java interface is almost identical to a C++ class that has nothing but pure virtual functions. Inherent in java is not efficient from more than one base class; even if the base classes have nothing but abstract methods or pure virtual functions. The differences between Java and C++ can be summarized as in <xref ref-type="table" rid="table1">Table 1</xref>.</p><p>The time needed to execute some code, algorithm, program or complete system program is considered critical in any programming language, in this paper the time needed to execute some same code in both Java and C++ is used to compare between such two languages. The minimum time needed to execution is an advantage because it reflects how much is the language is powerful and efficient. The minimum time of execution means more speed of execution which is the main goal of any designer or programmer.</p><p>Many researches and studies discussed this issue, Lutz Prechelt, (1999), discussed the relative efficiency of Java programs, in particular in comparison to well established implementation languages such as C or C++. Java is often considered very slow and memory-intensive. Most benchmarks, however compare only a single implementation of a program in, say, C++ to one implementation in Java, neglecting the possibility that alternative implementations might compare differently. In contrast, the current article presents a comparison of 40 different implementations of the same program, written by 40 different programmers. The inter-personal program differences are larger than those between the languages and the performance gap between Java and other languages is still shrinking rapidly, [<xref ref-type="bibr" rid="scirp.21960-ref1">1</xref>].</p><p>Peter Sestoft, 2010, they compare the numeric performance of C, C# and Java on three small cases. Managed languages such as C# and Java are easier and safer to use than traditional languages such as C or C++ when manipulating dynamic data structures, graphical user interfaces, and so on, [<xref ref-type="bibr" rid="scirp.21960-ref2">2</xref>]. Dirk E. et al. (2011), discussed the RC++ package simplifies integrating C++ code with R. It provides a consistent C++ class hierarchy that maps various types of R objects (vectors, matrices, functions, environments, ...) to dedicated C++ classes. Object interchange between R and C++ is managed by simple, flexible and extensible concepts which include broad support for C++ Standard Template Library idioms. C++ code can be compiled, linked and loaded on the y, or added via packages. Flexible error and exception code handling is provided. RC++ substantially lowers the barrier for programmers wanting to combine C++ code with R. [3,6].</p><p>Michi H. et al. 2012, compared between Windows Communication Foundation and Java: Remote Method Invocation which are currently seen as major contenders in the middleware space, performance is often taken as the sole evaluation criterion, despite the fact that performance is only one of many factors that influence the choice of middleware. They provided a performance and scalability comparison of the three middleware platforms, and discussed when performance and scalability matter and when they do not, including their likely impact alongside other factors on the overall cost of a project. Finally, for those applications that indeed require high performance and scalability, the article points out a few techniques you can use to get the biggest bang for your buck, [<xref ref-type="bibr" rid="scirp.21960-ref7">7</xref>].</p></sec><sec id="s2"><title>2. Results and Discussion</title><p>From last comparing between Java and C++, the main thing that may reveal which software is better is the time to execute the same algorithm. So as an example consider the following Java code:</p><p>public class RealTime</p><p>{</p><p>public void Do()//must complete in 500 μs</p><p>{</p><p>Clock c = new Clock; //might collect!</p><p>// diddle with clock for 100 μs</p><p>}</p><p>}</p><p>If this code is executed using both Java and C++, Java takes 500 μs to be complete such algorithm. This is a typical constraint in a hard real time system. Those functions that call {Real Time. Do()}depend on the fact that it will take no longer than 500 μs to execute. While the same function takes just 450 micro seconds to be executed using C++. The goal of the experiment is to measure the time needed to execute the same code on both Java and C++.&#160;</p><p><xref ref-type="fig" rid="fig1">Figure 1</xref> shows a time of execution comparison between Java and C++. It is clear that C++ is faster than Java which can be represented as:</p></sec></body><back><ref-list><title>References</title><ref id="scirp.21960-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">P. Lutz, “Comparing Java vs C/C++ Efficiency Differences to Inter-Personal Differences,” Communications of the ACM, Fakult at fur Informatik University, Karlsruhe, 1999.</mixed-citation></ref><ref id="scirp.21960-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">S. Peter, “Numeric Performance in C, C# and Java Peter Sestoft,” IT University of Copenhagen, Copenhagen, 2010.</mixed-citation></ref><ref id="scirp.21960-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">E. Dirk and F. Romain, “Rcpp: Seamless R and C++ Integration,” 2010. http://dirk.eddelbuettel.com/</mixed-citation></ref><ref id="scirp.21960-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">W. Peng, M. Sam, M. J. Moreira and G. Manish, “Efficient Support for Complex Numbers in Java,” ACM 1999 Java Grande Conference, San Francisco, 12-14 June 1999, pp. 109-118.</mixed-citation></ref><ref id="scirp.21960-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">J. E. Moreira, S. P. Midkiff, M. Gupta, P. V. Artigas, M. Snir and R. D. Lawrence, “Java Programming for High Performance Numerical Computing,” IBM Systems Journal, Vol. 39, No. 1, 2000, pp. 21-56. 
doi.org/10.1147/sj.391.0021</mixed-citation></ref><ref id="scirp.21960-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">J. Glenn, C. M. Clement, S. Q. Snell and G. Vladimir, “Design Issues for Efficient Implementation of MPI in Java,” ACM 1999 Java Grande Conference, San Francisco, 12-14 June 1999, pp. 58-65.</mixed-citation></ref><ref id="scirp.21960-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">H. Michi and S. Mark, “Choosing Middleware: Why Performance and Scalability Do (and Do Not) Matter,” ZeroC, Inc., Palm Beach Gardens, 2011.</mixed-citation></ref></ref-list></back></article>