Impossible task (Cai Xueqi)

xiaoxiao2021-03-06  43

2,000 June 2, the movie star Tom Curse ... OOPS! Tom CRUSE, no, I said Tom Cruise (Tom Cruise) to the Taiwan propaganda new film Mission: Impossible 2 (impossible task 2). Although I haven't seen it, let's guess the results: our handsome TOM will not let the global fans disappointed, in the film, he will have completed the impossible task again (may have a beautiful person. Bonus returned. According to my opinion, this task can only be called "Mission: Difficult (difficult task)", of course, a movie company that is good at marketing will definitely not take such a nameless name, as if Tom is a WIMP.

"Continuously completed the two tasks, but also it is impossible task, I see Tom's boss's boss's boss's hierarchy has problems ..." I don't want to pay. It is impossible to say that there is an impossible task, I have one in my heart, that is, "Let Java execute more than Native C / C " through the virtual machine.

Before the HotSpot virtual machine 1.0, Sun used the one year of time in HotSpot, the most interesting of the sky, the most interesting "HotSpot can greatly enhance the speed of Java, make it executed Effectiveness approximation C / C , or exceeds C / C . Oh my God! "Even exceed C / C ", this kind of thing is indeed worth a special book. But think about it, how can I exceed the Native Code of C / C ? From the principle of the compiler, this is impossible!

A program must be executed, must pass six major steps, respectively: tutorial analysis, grammatical analysis, language analysis, generate intermediate code, optimization, and purpose code. The solid-translated language does not need to be compiled and executed by the direct translator. The purely compiled language needs to be compiled before the program execution, and after the six steps described above get the execution file, this execution file is used In the end, the hardware platform instruction set and related library, so it can be implemented directly, no direct translator, such an executive we calls Native Code.

In addition to pure transliteration and pure language, there is a mixed language, and traditional Java belongs to this. The Java program requires a compiler to perform the top four steps (quantum analysis, grammatical analysis, language analysis, generating intermediate code), which is the Class file. These Class files cannot be executed directly, requiring the actor to perform the final translation step to execute.

C / C is a purely compiled language, so the program must be compiled into the instruction set of the platform. It is not like Java to be translated. Therefore, the execution of C / C is naturally much faster than Java's Class. Therefore, as long as the Java program is executed on a virtual machine, no matter what algorithm is used to accelerate (including Jit Compiler), it is still impossible to fast than C / C Native Code.

After I have explained, you should also understand why Java's speed has not been satisfied. But in order to get the benefits of cross-platform, this sacrifice is also worth it. What's more, the performance effect of a new generation of Java virtual machines has been progressing, but however, how to advance or not beyond C / C Native Code. what! You say that some people know that their virtual machines can make Java execution performance "better than assembly language." I think this is not missing: impossible, but Mission: laughable. Call those people to go to the "Compiler Principle", don't come out and laugh.

转载请注明原文地址:https://www.9cbs.com/read-73031.html

New Post(0)