[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Speed in Languages and Browser Architectures

  • From: <Peter.Kirkham@g...>
  • To: <oscar.vives@g...>,<xml-dev@l...>
  • Date: Thu, 1 Mar 2007 11:55:56 -0000

RE:  Speed in Languages and Browser Architectures
Whether C (as compiled by MS Visual C++ 6.0) is faster than Java (as
implemented in Sun's JRE version 1.6) depends more on whether you use
Java in an object-oriented manner or a Fortran-esqe manner. If you're
only operating on arrays of numbers, such as in the SciMark tests, or
many 3D operations, there's no speed difference C to Java [
http://blogs.sun.com/dagastine/entry/java_is_faster_than_c ]. More
modern C compilers (VS2005, g++ 4) create faster C programs.

Of course many Java programmers don't program Java as though it were C,
and the lack of 'const' or any more advanced memory write-locking
techniques in Java means it often has to copy arrays for safety, so it
suffers in the many real world uses.

Comparing C to C++ depends whether you are writing safe, portable C++
and using stl containers (sometimes only half the speed of C in tight
loops) or using processor architecture specific SIMD intrinsics and
direct pointers for arrays (for SSE2, up to twice the speed of C for
doubles, four times for floats, 16 times for octets, depending on degree
of parallelisation available in the algorithm and the capabilities of
the target architecture). 

Many of the differences between OSes are now cosmetic - so you have to
rewrite your front end whatever language you're using, but any
algorithmic code will probably be compatible for the same processor
architecture and different standard library implementations. If you're
not using the same processor architecture, then intrinsics need to
change [
http://developer.apple.com/hardwaredrivers/ve/sse.html#Translation ]. If
you have appropriate unit tests and text processing tools, that sort of
change is not anyway near as hard as getting a Java app to look right on
both OS X and Vista.

Currently, the tamarin project [
http://www.mozilla.org/projects/tamarin/ ] is using on-the-fly
compilation and type annotation to improve performance of JavaScript.
This trades some of the advantages of Variant types in rapid development
for a simple mechanism to improve performance. It's still not
competitive with VC++6.0/Java for speed - its goal is to make JS ten
times faster, not a thousand.

Projects such as Self indicate that it is possible to use HotSpot-like
on-the-fly compilation for dynamically typed languages [
http://www.cs.ucsb.edu/~urs/oocsb/papers/tapos96.shtml ]; if you had a
runtime for dynamically typed languages which used such techniques to
generate SIMD, cache line optimised code, it should be competitive with
C or even Fortran, even when using a more modern compiler which also has
parallel optimisations. It may be that the dynamic extensions to the JVM
will allow this, but I suspect the granularity of its object model will
limit its optimisations - given f(x)=>x+1, g(x)=>x+1, it can't optimise
f(g(x)) to \(x)=>x+2, or a loop using f(0..9) to one using [1..10]. 


Pete


-----Original Message-----
From: Tei [mailto:oscar.vives@g...] 

If you really need raw speed C or C++ will be always faster than Java.
But will be even more expensive than Java, because you need to rewrite
code for different OS.

Theres also stuff, like the Variant type, usefull to make code cheaper,
but slower.
--


This email and any files attached are intended for the addressee and may contain information of a confidential nature. If you are not the intended recipient, be aware that this email was sent to you in error and you should not disclose, distribute, print, copy or make other use of this email or its attachments. Such actions, in fact, may be unlawful. In compliance with the various Regulations and Acts, General Dynamics United Kingdom Limited reserves the right to monitor (and examine for viruses) all emails and email attachments, both inbound and outbound. Email communications and their attachments may not be secure or error- or virus-free and the company does not accept liability or responsibility for such matters or the consequences thereof.  General Dynamics United Kingdom Limited, Registered Office: 100 New Bridge Street, London EC4V 6JA. Registered in England and Wales No: 1911653.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.