Content deleted Content added
m Reverted edits by 83.22.178.143 (talk) (HG) (3.4.11) |
Citation bot (talk | contribs) Add: journal. Removed parameters. Some additions/deletions were parameter name changes. | Use this bot. Report bugs. | Suggested by Abductive | Category:Use mdy dates from October 2018 | via #UCB_Category 1224/1480 |
||
Line 25:
| first=Kohsuke
| date=March 30, 2008
|
| archive-url=https://web.archive.org/web/20080402034758/http://weblogs.java.net/blog/kohsuke/archive/2008/03/deep_dive_into.html
| archive-date=April 2, 2008
Line 35:
| title=Fast, Effective Code Generation in a Just-In-Time Java Compiler
| publisher=[[Intel Corporation]]
|
Some benchmarks show a 10-fold speed gain by this means.<ref>This [http://www.shudo.net/jit/perf/ article] shows that the performance gain between interpreted mode and Hotspot amounts to more than a factor of 10.</ref> However, due to time constraints, the compiler cannot fully optimize the program, and thus the resulting program is slower than native code alternatives.<ref>[http://www.itu.dk/~sestoft/papers/numericperformance.pdf Numeric performance in C, C# and Java ]</ref><ref>[http://www.cherrystonesoftware.com/doc/AlgorithmicPerformance.pdf Algorithmic Performance Comparison Between C, C++, Java and C# Programming Languages] {{webarchive|url=https://web.archive.org/web/20100331155325/http://www.cherrystonesoftware.com/doc/AlgorithmicPerformance.pdf |date=March 31, 2010 }}</ref>
Line 46:
| title=The Java HotSpot Virtual Machine, v1.4.1
| publisher=[[Sun Microsystems]]
|
| url=http://headius.blogspot.com/2008/01/langnet-2008-day-1-thoughts.html
| title=Lang.NET 2008: Day 1 Thoughts
Line 52:
| last=Nutter|first=Charles
| date=January 28, 2008
|
===Garbage collection===
Line 72:
|title = New Java SE 6 Feature: Type Checking Verifier
|publisher = Java.net
|
}}{{dead link|date=November 2017 |bot=InternetArchiveBot |fix-attempted=yes }}</ref>
*Design-time – when compiling a class from source to bytecode
Line 103:
|author=Brian Goetz
|date=October 18, 2005
|
Since version 6u23, Java includes support for escape analysis.<ref>{{cite web
Line 110:
|publisher=[[Oracle Corporation]]
|quote=''Escape analysis is a technique by which the Java Hotspot Server Compiler can analyze the scope of a new object's uses and decide whether to allocate it on the Java heap. Escape analysis is supported and enabled by default in Java SE 6u23 and later.''
|
====Register allocation improvements====
Line 155:
|last=Haase|first=Chet
| quote=''At the OS level, all of these megabytes have to be read from disk, which is a very slow operation. Actually, it's the seek time of the disk that's the killer; reading large files sequentially is relatively fast, but seeking the bits that we actually need is not. So even though we only need a small fraction of the data in these large files for any particular application, the fact that we're seeking all over within the files means that there is plenty of disk activity.''
|date= May 2007|
*Parts of the platform needed to execute an application accessed from the web when JRE is not installed are now downloaded first. The full JRE is 12 MB, a typical Swing application only needs to download 4 MB to start. The remaining parts are then downloaded in the background.<ref>{{Cite web
| url=http://java.sun.com/developer/technicalArticles/javase/consumerjre#JavaKernel
Line 161:
| publisher=Sun Microsystems
| last=Haase|first=Chet
|date= May 2007|
*Graphics performance on [[Microsoft Windows|Windows]] improved by extensively using [[Direct3D]] by default,<ref>{{Cite web|url=http://java.sun.com/developer/technicalArticles/javase/consumerjre#Performance|title=Consumer JRE: Leaner, Meaner Java Technology|publisher=Sun Microsystems|last=Haase|first=Chet|date= May 2007|
===Java 7===
Line 171:
| publisher=Sun Microsystems
|last=Haase|first=Chet
|date= May 2007|
*Provide JVM support for [[dynamic programming language]]s, following the prototyping work currently done on the [[Da Vinci Machine]] (Multi Language Virtual Machine),<ref>{{Cite web
| url=http://www.jcp.org/en/jsr/detail?id=292
| title=JSR 292: Supporting Dynamically Typed Languages on the Java Platform
| publisher=jcp.org
|
*Enhance the existing concurrency library by managing [[parallel computing]] on [[multi-core]] processors,<ref>{{Cite web
| url=http://www.ibm.com/developerworks/java/library/j-jtp03048.html?ca
Line 182:
| last=Goetz|first=Brian
| date=March 4, 2008
|
| url=http://www.infoq.com/news/2008/03/fork_join
| title=Parallelism with Fork/Join in Java 7
Line 188:
| publisher=infoq.com
| date=March 21, 2008
|
*Allow the JVM to use both the ''[[HotSpot (virtual machine)#Features|client]]'' and ''server'' [[Just-in-time compilation|JIT compilers]] in the same session with a method called tiered compiling:<ref>{{Cite web
| url=http://developers.sun.com/learning/javaoneonline/2006/coreplatform/TS-3412.pdf
| title=New Compiler Optimizations in the Java HotSpot Virtual Machine
| publisher=Sun Microsystems
|date= May 2006|
**The ''client'' would be used at startup (because it is good at startup and for small applications),
**The ''server'' would be used for long-term running of the application (because it outperforms the ''client'' compiler for this).
Line 202:
| last=Humble|first=Charles
| date=May 13, 2008
|
}}</ref><ref>
{{Cite web
Line 210:
| first=Danny
| date=November 12, 2008
|
| archive-url=https://web.archive.org/web/20111208114910/http://blogs.oracle.com/theplanetarium/entry/java_vm_trying_a_new
| archive-date=December 8, 2011
Line 226:
| title=Computer Language Benchmarks Game
| publisher=benchmarksgame.alioth.debian.org
|
| archive-url=https://web.archive.org/web/20150125100238/http://benchmarksgame.alioth.debian.org/u32q/which-programs-are-fastest.html
| archive-date=January 25, 2015
Line 237:
| title=Computer Language Benchmarks Game
| publisher=benchmarksgame.alioth.debian.org
|
| archive-url=https://web.archive.org/web/20150113040554/http://benchmarksgame.alioth.debian.org/u64q/java.html
| archive-date=January 13, 2015
Line 246:
| title=Computer Language Benchmarks Game
| publisher=benchmarksgame.alioth.debian.org
|
| archive-url=https://web.archive.org/web/20150110034032/http://benchmarksgame.alioth.debian.org/u64q/csharp.html
| archive-date=January 10, 2015
Line 255:
| title=Computer Language Benchmarks Game
| publisher=benchmarksgame.alioth.debian.org
|
| archive-url=https://web.archive.org/web/20150102034407/http://benchmarksgame.alioth.debian.org/u64q/python.html
| archive-date=January 2, 2015
Line 265:
Benchmarks often measure performance for small numerically intensive programs. In some rare real-life programs, Java out-performs C. One example is the benchmark of [[Jake2]] (a clone of [[Quake II]] written in Java by translating the original [[GPL]] C code). The Java 5.0 version performs better in some hardware configurations than its C counterpart.<ref>: 260/250 [[Frame rate|frame/s]] versus 245 frame/s (see [http://www.bytonic.de/html/benchmarks.html benchmark])</ref> While it is not specified how the data was measured (for example if the original Quake II executable compiled in 1997 was used, which may be considered bad as current C compilers may achieve better optimizations for Quake), it notes how the same Java source code can have a huge speed boost just by updating the VM, something impossible to achieve with a 100% static approach.
For other programs, the C++ counterpart can, and usually does, run significantly faster than the Java equivalent. A benchmark performed by Google in 2011 showed a factor 10 between C++ and Java.<ref>{{Cite journal |last1=Hundt |first1=Robert |title=Loop Recognition in C++/Java/Go/Scala |
| url= http://www.best-of-robotics.org/pages/publications/gherardi12java.pdf
| title=A Java vs. C++ performance evaluation: a 3D modeling benchmark
Line 271:
|author1=L. Gherardi |author2=D. Brugali |author3=D. Comotti | year= 2012
| quote=''Using the Server compiler, which is best tuned for long-running applications, have instead demonstrated that Java is from 1.09 to 1.91 times slower(...)In conclusion, the results obtained with the server compiler and these important features suggest that Java can be considered a valid alternative to C++''
|
Some optimizations that are possible in Java and similar languages may not be possible in certain circumstances in C++:<ref name="idiom">{{Cite web|url=http://scribblethink.org/Computer/javaCbenchmark.html |title=Performance of Java versus C++ |publisher=Computer Graphics and Immersive Technology Lab, University of Southern California| author=Lewis, J.P. |author2=Neumann, Ulrich}}</ref>
Line 282:
| title=The Java HotSpot Performance Engine: Method Inlining Example
| publisher=[[Oracle Corporation]]
|
| url=http://blog.headius.com/2008/05/power-of-jvm.html
| title=The Power of the JVM
Line 288:
| last=Nutter|first=Charles
| quote=''What happens if you've already inlined A's method when B comes along? Here again the JVM shines. Because the JVM is essentially a dynamic language runtime under the covers, it remains ever-vigilant, watching for exactly these sorts of events to happen. And here's the really cool part: when situations change, the JVM can deoptimize. This is a crucial detail. Many other runtimes can only do their optimization once. C compilers must do it all ahead of time, during the build. Some allow you to profile your application and feed that into subsequent builds, but once you've released a piece of code it's essentially as optimized as it will ever get. Other VM-like systems like the CLR do have a JIT phase, but it happens early in execution (maybe before the system even starts executing) and doesn't ever happen again. The JVM's ability to deoptimize and return to interpretation gives it room to be optimistic...room to make ambitious guesses and gracefully fall back to a safe state, to try again later.''
|
Results for [[Benchmark (computing)|microbenchmarks]] between Java and C++ highly depend on which operations are compared. For example, when comparing with Java 5.0:
Line 296:
| publisher=[[Dr. Dobb's Journal]]
| date=July 1, 2005
|
| url=http://www.ddj.com/java/184401976?pgno=12
| title=Microbenchmarking C++, C#, and Java: 64-bit double arithmetic
| publisher=[[Dr. Dobb's Journal]]
| date=July 1, 2005
|
| url=http://www.ddj.com/java/184401976?pgno=15
| title=Microbenchmarking C++, C#, and Java: File I/O
| publisher=[[Dr. Dobb's Journal]]
| date=July 1, 2005
|
| url=http://www.ddj.com/java/184401976?pgno=17
| title=Microbenchmarking C++, C#, and Java: Exception
| publisher=[[Dr. Dobb's Journal]]
| date=July 1, 2005
|
*[[Array data type|Array]]s<ref>{{Cite web
| url=http://www.ddj.com/java/184401976?pgno=19
Line 317:
| publisher=[[Dr. Dobb's Journal]]
| date=July 1, 2005
|
*[[Trigonometric functions]] performance is much better in C.<ref>{{Cite web
| url=http://www.ddj.com/java/184401976?pgno=19
Line 323:
| publisher=[[Dr. Dobb's Journal]]
| date=July 1, 2005
|
----
Line 347:
|title = How fast is the new verifier?
|date = February 7, 2006
|
|url-status = dead
|
|
|df = dmy-all
}}</ref>
Line 365:
{{Disputed section|Most_of_the_memory_use_section_is_really_odd_nitpicks|date=August 2019}}
Java memory use is much higher than C++'s memory use because:
*There is an overhead of 8 bytes for each object and 12 bytes for each array<ref>http://www.javamex.com/tutorials/memory/object_memory_usage.shtml</ref> in Java. If the size of an object is not a multiple of 8 bytes, it is rounded up to next multiple of 8. This means an object holding one byte field occupies 16 bytes and needs a 4-byte reference. C++ also allocates a [[Pointer (computer programming)|pointer]] (usually 4 or 8 bytes) for every object which class directly or indirectly declares [[virtual function]]s.<ref>{{cite web |url=http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=195 |title=Archived copy |
*Lack of address arithmetic makes creating memory-efficient containers, such as tightly spaced structures and [[XOR linked list]]s, currently impossible ([[Project Valhalla (Java language)|the OpenJDK Valhalla project]] aims to mitigate these issues, though it does not aim to introduce pointer arithmetic; this cannot be done in a garbage collected environment).
*Contrary to malloc and new, the average performance overhead of garbage collection asymptotically nears zero (more accurately, one CPU cycle) as the heap size increases.<ref>https://www.youtube.com/watch?v=M91w0SBZ-wc : Understanding Java Garbage Collection - a talk by Gil Tene at JavaOne</ref>
Line 380:
| title= Math (Java Platform SE 6)
| publisher= [[Sun Microsystems]]
|
}}</ref> On the [[x87]] floating point subset, Java since 1.4 does argument reduction for sin and cos in software,<ref>
{{Cite web
| url=http://blogs.oracle.com/jag/entry/transcendental_meditation
| title=Transcendental Meditation
|
| date=July 27, 2005
| first=James
Line 400:
| first=Christopher
| date=January 8, 2004
|
| archive-url=https://web.archive.org/web/20181011222232/http://www.osnews.com/story/5602%26page%3D3
| archive-date=October 11, 2018
Line 415:
| publisher=[[Sun Microsystems]]
| year=2001
|
</ref><ref>{{Cite web
|url = http://janet-project.sourceforge.net/papers/jnibench.pdf
Line 422:
|first = Dawid
|author2 = Vaidy Sunderam
|
|url-status = dead
|
|
|df = dmy-all
}}</ref> [[Java Native Access]] (JNA) provides [[Java (programming language)|Java]] programs easy access to native [[Shared library|shared libraries]] ([[dynamic-link library]] (DLLs) on Windows) via Java code only, with no JNI or native code. This functionality is comparable to Windows' Platform/Invoke and [[Python (programming language)|Python's]] ctypes. Access is dynamic at runtime without code generation. But it has a cost, and JNA is usually slower than JNI.<ref>{{Cite web
Line 431:
|title = How does JNA performance compare to custom JNI?
|publisher = [[Sun Microsystems]]
|
}}{{dead link|date=November 2017 |bot=InternetArchiveBot |fix-attempted=yes }}</ref>
Line 443:
|date = May 10, 2005
|quote = ''It is hard to give a rule-of-thumb where SWT would outperform Swing, or vice versa. In some environments (e.g., Windows), SWT is a winner. In others (Linux, [[VMware]] hosting Windows), Swing and its redraw optimization outperform SWT significantly. Differences in performance are significant: factors of 2 and more are common, in either direction''
|
|archive-url = https://web.archive.org/web/20080704103309/http://cosylib.cosylab.com/pub/CSS/DOC-SWT_Vs._Swing_Performance_Comparison.pdf
|archive-date = July 4, 2008
Line 456:
| quote=''We first perform some micro benchmarks for various JVMs, showing the overall good performance for basic arithmetic operations(...). Comparing this implementation with a Fortran/MPI one, we show that they have similar performance on computation intensive benchmarks, but still have scalability issues when performing intensive communications.''
|author1=Brian Amedro |author2=Vladimir Bodnartchouk |author3=Denis Caromel |author4=Christian Delbe |author5=Fabrice Huet |author6=Guillermo L. Taboada | publisher=[[INRIA]]
|date= August 2008 |
However, high performance computing applications written in Java have won benchmark competitions. In 2008,<ref>{{Cite web
Line 464:
|author = Owen O'Malley - Yahoo! Grid Computing Team
|date = July 2008
|
|url-status = dead
|
|
|df = dmy-all
}}
Line 478:
| date=May 11, 2009
| quote=''The hardware and operating system details are:(...)Sun Java JDK (1.6.0_05-b13 and 1.6.0_13-b03) (32 and 64 bit)''
|
| publisher=[[CNET.com]]}}
</ref><ref>{{Cite web
Line 484:
| title=Hadoop breaks data-sorting world records
| date=May 15, 2009
|
| publisher=[[CNET.com]]}}
</ref> an Apache [[Hadoop]] (an open-source high performance computing project written in Java) based cluster was able to sort a terabyte and petabyte of integers the fastest. The hardware setup of the competing systems was not fixed, however.<ref>{{cite web
| url=http://sortbenchmark.org/
| title=Sort Benchmark Home Page
|author1=Chris Nyberg |author2=Mehul Shah |
}}</ref><ref name=googlemapreduce>{{cite web
| url=http://googleblog.blogspot.com/2008/11/sorting-1pb-with-mapreduce.html
| title=Sorting 1PB with MapReduce
| date=November 21, 2008
|
| first=Grzegorz
| last=Czajkowski
Line 516 ⟶ 515:
{{cite news |url=http://www.cnet.com/news/short-take-apple-licenses-symantecs-just-in-time-compiler/
| title=Short Take: Apple licenses Symantec's just-in-time compiler |publisher= cnet.com
| date= May 12, 1998 |
}}
|