PROGRAMMING EBOOKS JAVA(TM) RUNTIME SPEED

Programming Ebooks Java(tm) Runtime Speed

main() { int i; int j; brief t; // cum with degressive visit for (i = 0; i < N; i++) vec[i] = N – i; // variety into rising visit for (i = 0; i < N – 1; i++) { for (j = i + 1; j < N; j++) { if (vec[i] > vec[j]) { t = vec[i]; vec[i] = vec[j]; vec[j] = t; } } } convey 0; }

This is cod to the understood nature of Java and also cod to the player runtime checking that it does (such as for discover of extent agent subscripts). This portion operation formula isn’t rattling economical (it has N**2 performance), but is informatory of the point.

Consider added Java program:

        // sort crunching            collection bm2 {                  open noise vacuum main(String args[])                  {                          daylong i = 1200000L;                          threefold d;                          patch (i > 0) {                                  d = Math.sqrt((double)i) + Math.log((double)i);                                  i--;                          }                  }          }

This information is exclusive most 3 nowadays slower than the equal C++:

        // sort crunching            #include <math.h>            main()          {                  daylong i = 1200000L;                  threefold d;                    patch (i > 0) {                          d = sqrt(double(i)) + log(double(i));                          i--;                  }                    convey 0;          }

Why the difference? Well, in this ordinal program, most of the instance is condemned in executing the science functions sqrt() and log(). These functions are typically implemented in element or via low-level cipher routines (“native” methods). If most of the instance is spent in them (math functions are typically quite expensive), then the informative disbursement required to appendage the wrap iterations and so on is inferior important.

In some cases this disagreement in action isn’t rattling important. For example, if a Java information or applet is highly mutual or operates crossways the Internet, then the delays incurred by inactivity on humans and networks module be more essential than the nakedness pace of the language.

It relic to be seen meet how Java action module stir out. There are individual possibilities for rising it. One is to create autochthonous code, but this entireness against the portability of Java applets and applications. Another kindred framework that has been mentioned is a Java to C polyglot (“java2c”), but this also entireness against portability.

There is a framework titled “just in time” assembling that is existence considered. The framework involves doing impulsive assembling within the bytecode interpreter, so that the incoming instance a bytecode is executed, the actualised organisation cipher for a presented papers is substituted in its place.

Download

 

This entry was posted on Friday, December 26th, 2008 and is filed under Computer Engineering, Computer Science, Computers (Other), ebooks, Free Ebooks, Java Books, Programming, Self-development, Systems & Technology. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.