外文翻譯--分析和比較開(kāi)放和封閉的移動(dòng)平臺(tái)_第1頁(yè)
已閱讀1頁(yè),還剩18頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、<p><b>  附 錄 </b></p><p>  An Analysis and Comparison of Open and Closed Mobile</p><p><b>  Platforms</b></p><p>  Android vs. iPhone</p><

2、p>  1. Introduction</p><p>  In recent years, the popularity of smart phone kept going up. More and more smart phones are sold anda lot of people are embracing them. Smart phones brought great convenience

3、 to users, as well created opportunities for smart phone researchers. That’s to say, the wide spread of smart phones benefited both sides. At the same time, developing of smart phone OS becomes one of the smartest indust

4、ry. To be a smart phone OS, the system should: 1. Provide services like a PC. 2. Work with a GPU for bett</p><p>  Now the 2 giants of smart phone OS are Android and iPhone OS. On one side, Android is based

5、on Linux kernel and Dalvik virtual machine, and it is open sourced. The upper layer of Android is Java based,allowing developers to develop Android applications with Google SDK and sell their software in Android Market.

6、On the other side, iPhone OS, which bases on Unix kernel and Darwin model but is closed sourced,evolves from Mac OS X and is the default OS of iPhone, iPod Touch and iPad. Objective C base</p><p>  By compar

7、ing the latest Android and iPhone OS, Android 2.2 Froyo and iOS 4, we can take a glimpse at the main feature of open and closed smart phone OSs. While the 2 OSs are designed in rather different mentality and functionalit

8、y, it’s a little early to tell which one is better.</p><p>  2. Smart Phone OS</p><p>  2.1. Android</p><p>  The system architecture of Android consists of 5 layers, which are Linu

9、x Kernel, Android Runtime, Libraries, Application Framework and Applications, from bottom to top.</p><p>  Android provides core services like security, memory management, process management, network stack

10、and drivers, basing on Linux 2.6. Being the abstract layer between software and hardware, the layer of Linux Kernel hides the implementing details of hardware and provides integrated services for upper layer.</p>

11、<p>  Dalvik virtual machine and Java core libraries are included in the layer of Android Runtime, providing most functions in Java core libraries.</p><p>  The layer of Libraries contains a class of C/

12、C++ libraries for Android components. Those libraries are integrated by the layer of Application Framework and then provided to developers.</p><p>  The layer of Application Framework provides all kinds of m

13、odules for program initialization to simplify the use of components, allowing developers do whatever they want and provide services for other softwares, under the limitation of security, of course.</p><p>  

14、Mainstream applications are located in the layer of Application, including e-mail, SMS, calendar, Google map, Web browser and contacts. Users interact directly with this layer[1][2] .</p><p>  The latest ver

15、sion of Android, Android 2.2 Froyo, puts on some new features. They are: 1. Support Flash 10.1, enables user to watch flash on the phone. 2. V8 JavaScript engine in web browser leads to faster Internet data transportatio

16、n. 3. Big advance in network sharing. You can use the phone as a 3G NIC,or convert 3G signal to Wi-Fi. 4. Automatically software update. 5. Softwares can be setup in SD card to extend file storages.</p><p> 

17、 2.2. iPhone</p><p>  iPhone OS is consist of 4 abstract layers: Core OS, Core Service, Media and Cocoa Touch respectively.</p><p>  Layers of Core OS and Core Service are designed in C language

18、 to handle core system services, enabling developers to perform file access, sockets calling and data handling. CFNetwork and SQLite are also parts of these 2 layers.</p><p>  The layer of Media, according

19、to its name, this layer is used to control video and audio, as well handle 2D and 3D images. The Open GL-ES Quratz part of the layer is coded with C language, while the part of Core-Audio and Core-Animation is Objective

20、C based.</p><p>  The layer of Cocoa Touch builds a basic framework for all kinds of programs in iPhone. Most programs run in Cocoa Touch layer, and it’s surely Objective C based .</p><p>  The

21、latest iPhone OS is iOS 4. It includes the following new features: 1.Software classification. This</p><p>  feature enables user to place sorted softwares into different documents, making it clearer to manag

22、e. 2. Email integration. One account is for all e-mails from different providers. 3. iBook, originally from iPad, is built in iOS. 4. A brand new Apple Game Center makes iPhone a tremendous entertainment platform.</p&

23、gt;<p>  2.3. Android vs. iPhone</p><p>  Being the top 2 smart phone OSs, we’re sure that both Android and iPhone have their own advantages and disadvantages. Now let’s take a look at each of them, a

24、nd see what unique feature they have.</p><p>  Android 2.2 Froyo fully support multitask, which means you can listen to music while writing blog. And iOS 4, officially announced to be ‘multitasked’, is in f

25、act a play of concept. Only a few of softwares which are authorized by Apple can run ‘simultaneously’, whose principle is much easier that multitask:when an application is switched out, its current state is saved and the

26、n the system just closes it. And when it’s switched in, we’re back to the previous snapshot .</p><p>  During the publication of Android 2.2 Froyo, Google announced it has ‘the most fluent web browser’,becau

27、se the use of V8 JavaScript engine. V8 is a brand new engine, designed for running big size JavaScript application. In some kind of tests, V8 is much faster than JScript from Internet Explorer, SpiderMonkey from Firefox

28、and JavaScriptCore from Safari. It all owe to 3 key parts of V8, they’re fast attribute access, dynamic code generation, effective trash cleaning. </p><p>  2.3.1. Fast Attribute Access</p><p> 

29、 JavaScript is a kind of dynamic language, which means attributes can be added or deleted at runtime, and they’re frequently changed. Most JavaScript engines use a dictionary style structure to store the attributes of a

30、n object, so it requires a whole dictionary search to find the position of attributes in memory.It’s quite inefficient and it’s slower than Java and Smalltalk.</p><p>  To solve this problem, V8 discarded dy

31、namic search and realized it in a different way: Create hidden classes for objects dynamically. In JavaScript, every time when we’re adding a new attribute to an object,we create a subclass with the new attribute from a

32、hidden class as the super class. It’s a recursive course and the above performance happens only once when we first do this. Later we just use the previous hidden subclass when we’re in the same situation. So there’s no n

33、eed to repeat operatio</p><p>  2.3.2. Dynamic Code Generation</p><p>  When JavaScript is running for the very first time, V8 translate it directly into local machine code, rather than explain

34、it to bytecode. Attribute access is done by inner cache, which is often translated into instructions by V8 at runtime.</p><p>  When it comes to the code where certain object is accessed, V8 tries to find th

35、e current hidden class. Meanwhile, V8 assumes that all objects in the snippet are described by the same hidden class, so V8 willmodify corresponding inner cache to make the direct use of the hidden class more convenient

36、. If thisassumption is correct, the access of attributes can be all done in only 1 instruction. Even if the predictionfails, inner cache is modified again by V8, which won’t take too much time and reso</p><p&g

37、t;  2.3.3. Effective Trash Cleaning</p><p>  V8 does memory recycles automatically. To guarantee the speed of object distribution, as well cut the time of trash cleaning and clear fragment up, V8 will interr

38、upt the running application when performing trash cleaning. Mostly, only a small part of object stack is involved in trash cleaning cycle, so the interruption caused little. All location of objects and pointers are logge

39、d by V8, so the system won’t take object for pointer and memory overflow is avoided.</p><p>  Besides ‘the most fluent web browser’, Google collaborated with Adobe and Android 2.2 Froyo fully supports Flash.

40、 That’s to say, not only flash media, but all flash web pages can display perfectly on Android. To the contrary, Apple turned down Adobe and take HTML5 as iPhone’s web protocol, making it unable to show some flash based

41、animation.</p><p>  Android 2.2 Froyo also leads the way in network sharing. Smart phone with Froyo can be connected toa PC as a 3G NIC, and can also conveniently convert 3G signal to Wi-Fi. iOS 4 can do the

42、 first too, butfailed to convert 3G to Wi-Fi.</p><p>  Video conference is both supported by Froyo and iOS 4, but the conditions are different. You can see aFroyo user via camera as long as you get a camera

43、also. However, iOS 4 user can only do video talk toanother iOS 4 user, which is a big limitation.</p><p>  While Android is ascendant in network interaction, Apple is unique in its friendship and entertainme

44、nt.The added feature of ‘software classification’ enables user to place sorted softwares into differentdocuments, making it clearer to manage. What’s more, there’re hundreds of thousands applications inApp Store, meaning

45、 that iPhone can have up to hundreds of thousands functions. This is a ratherremarkable feature that Apple publicizes.</p><p>  And the most convincing point given by Apple, is that ‘Android looks exactly fa

46、miliar with iPhone.’ Although it’s just a subjective sense, the born of iPhone really brought big revolution to the phone industry, and the name ‘Apple’ itself is a world famous brand .</p><p>  3. Open and

47、 Closed platforms</p><p><b>  3.1. SDK</b></p><p>  The most important part of every developing platform is SDK, enable 3rd party developers to make software for the platform. Usuall

48、y, libraries, debug tools and emulators are included in SDK. Different platforms distribute their SDKs differently. Some SDK is complete free and open, while others are strictly limited.</p><p>  Developers

49、of open platforms can get and modify part or all of the source code. Google and Linux are leaders of open platforms; they publicized the whole source code of Android and Linux. The good point is that, platform owners can

50、 save a great amount of time and energy developing and maintaining the platform, because 3rd party developers will do this for them. With less money spent on development and maintenance, a relatively low price can attrac

51、t more and more phone users.</p><p>  Contrarily, closed platforms lock their source code in the safety and forbid 3rd party accesses. Apple and Microsoft are the representatives of them, they are both close

52、d sourced, but some differences do exists. 3rd party iPhone applications are restricted within narrow limits, for that Apple will look through every application which is uploaded onto ‘App Store’, and a lot of applicatio

53、ns are turned down.Microsoft don’t check Windows applications at all, it all depends on the users themselves. Y</p><p>  3.2. Application Market</p><p>  Market is the medium between developers

54、and users, hence it’s very important. Some predicted that there will be more and more application markets while some don’t think so. In current markets, both do exist. Some specify only one market for their products, whi

55、le others sell their softwares in various markets.</p><p>  Softwares from Nokia, Microsoft and Linux Mobile are sold in every market. Developers of these platforms can release their own application in whate

56、ver markets, so markets have to compete with each other for a living. This is good for users. However, the lack of universal management may lead to mess and chaos, softwares that have the same functionality exist in diff

57、erent markets, which confuses users a lot.</p><p>  Correspondingly, sole markets claim that most applications should be sold in them. This kind of monopolization leads to no competitor. ‘App Store’ and ’And

58、roid Market’ are deputy of sole markets. Normally, iPhone applications can only be found in ‘App Store’, and Apple will check every one of them by itself. Good news is that every application in ‘App Store’ is officially

59、tested, it’s safe; Bad news is that a lot of pretty good softwares are rejected for various reasons. And a big unofficial mec</p><p>  ‘Jailbreak’ is a process that allows iPad, iPhone and iPod Touch users t

60、o gain root access and unlock the operating system thus removing any limitations imposed upon them by Apple. Once jailbroken, iPhone users are able to download many extensions and themes previously unavailable through th

61、e App Store via installers such as Cydia. A jailbroken iPad, iPhone or iPod Touch is still able to use the App Store and iTunes.</p><p>  And a ‘SIM lock’ is a capability built into GSM phones by mobile phon

62、e manufacturers. Network</p><p>  providers use this capability to restrict the use of these phones to specific countries and network providers.Generally, phones can be locked to accept only SIM cards based

63、on the International Mobile Subscriber Identity. ‘SIM unlock’ make it possible to use a mobile phone without considering countries and networks specified by mobile phone manufacturers.</p><p>  However in An

64、droid, Google doesn’t test every application at all, so although there’s an official market for Android applications, you can still release your product anywhere you want. Considering security problems, Google banned the

65、 use of some components. Like ‘jailbreak’ and ‘SIM unlock’ in iPhone, ‘root’ in Android gives users 100% control of their devices, along with some security risks. ‘Root’ is a process that allows users of cellphones runni

66、ng the Android operating system to attain privi</p><p>  3.3. Integration</p><p>  Some companies focus only on their core industry, i.e. develop an operating system and provide an environment f

67、or 3rd party development. Others not only do these, but manage the process of developing a software to publicizing it. Depending on the integration of platforms, we sort them to 4 kinds: full integration platform, market

68、 integration platform, device integration platform and no integration platform.</p><p>  The publicizing model of full integration platform is very strict. Its management ranges from device manufacturing to

69、application release, whose representative is Apple. Apple’s factory produces iPhone, Apple’s ‘App Store’ sells application, Apple’s ‘iTunes’ is the channel of Apple’s resources. The whole process is under Apple’s control

70、.</p><p>  Market integration platforms commit themselves to developing and selling softwares. Google is one of them. Unlike apple, Google don’t have a factory to manufacture its own handsets, but only devel

71、oped Android and set up ‘Android Market’ for Android applications. However, companies like Google definitely have the capability to produce its own devices. Google is in good relationship with HTC, who is the OEM of T-Mo

72、bile, O2 and Orange, etc.</p><p>  Device integration platforms produce their own handsets, but don’t set up application markets. Forexample, RIM makes Blackberry, but there’s no official application market

73、for Blackberry. No integration platforms do few things. Microsoft neither makes mobile phones, nor sets up a market.What they do is only developing the operating system: Windows Phone 7.</p><p>  4. Conclusi

74、on</p><p>  Representatives of open and closed platforms, Android 2.2 Froyo and iOS 4 are both loved and hated.Great browsers are built into them, and their producers are both world famous revolutionary. And

75、roid leans to Internet experience, which comes down in one continuous line with Google. But currently, various versions of Android fill the market, and most companies in Open Handset Alliance tend to customize their own

76、Android systems. These facts make Android lack of a general brand image, so people ma</p><p>  Besides, Android 2.2 Froyo succeeds the features of open platforms well. It’s a ‘users only’ platform, because u

77、sers of Froyo can almost customize everything they want. And members of Open Handset</p><p>  Alliance tend to provide more choices for users. And iOS 4, typically closed platform member, manages everything

78、ranging from OS development to device manufacturing. It’s a ‘consider for users’ platform.To some extent, users of Android canonizes ‘free’ and ‘open’, what they care is if they have 100% management of their handsets, no

79、 matter whether the OS is called ‘Android’ or ‘Another’. Apple users are loyal to the brand; they would like to authorize Apple to make decisions for them. So although</p><p>  Both Android and iPhone have t

80、heir unique IDE, SDK and other characteristics. Believe it or not, no perfection exists in the world, so none of today’s mobile platforms fully meets the needs of users and researchers. The choice of platform boils down

81、to the needs of users and researchers, this article should make the decision easier. Of course the content of this article is time sensitive; platforms will gradually meet the demands of consumers as new technologies eme

82、rging.</p><p><b>  中文譯文</b></p><p>  分析和比較開(kāi)放和封閉的移動(dòng)平臺(tái)</p><p>  ————安卓和蘋(píng)果系統(tǒng)</p><p>  第一章 介 紹</p><p>  近年來(lái),智能手機(jī)的普及率不斷攀升。越來(lái)越多的智能手機(jī)被賣出和很多人都更加青睞于它

83、們。智能手機(jī)給用戶帶來(lái)了極大方便,并為智能手機(jī)研究者創(chuàng)建了機(jī)會(huì)。這就是說(shuō),智能手機(jī)的廣泛普及,對(duì)雙方都有利雙方。同時(shí),智能手機(jī)操作系統(tǒng)發(fā)展成為最智能的行業(yè)之一。要成為一個(gè)智能手機(jī)操作系統(tǒng),該系統(tǒng)應(yīng):1.提供服務(wù)PC式的服務(wù)。2.使用GPU得到更絢麗的視覺(jué)效果。 3.允許用戶在互聯(lián)網(wǎng)上自由地沖浪。顯然,它們也有一些弱點(diǎn):1,電池的限制。 2。較電腦CPU來(lái)說(shuō),手機(jī)CPU性能差。 3.存儲(chǔ)空間小。 4

84、.在手機(jī)電池耗盡時(shí),RAM的使用可能會(huì)導(dǎo)致數(shù)據(jù)丟失。</p><p>  現(xiàn)在智能手機(jī)操作系統(tǒng)的兩巨頭是Android和iPhone OS。一方面,Android是基于Linux內(nèi)核,Dalvik虛擬機(jī),它是開(kāi)源的。上層的Android是基于Java的,允許開(kāi)發(fā)者使用谷歌SDK開(kāi)發(fā)Android應(yīng)用程序和在Android 市場(chǎng)銷售他們的軟件。另一方面,iPhone操作系統(tǒng)基于Unix內(nèi)核和達(dá)爾文模型,但

85、它是封源的,是從Mac OS X繼承而來(lái),是iPhone,iPod Touch和iPad默認(rèn)的操作系統(tǒng)。基于C語(yǔ)言的軟件可以在iPhone OS上運(yùn)行,就像Android,你可以開(kāi)發(fā)自己的iPhone應(yīng)用程序,并上傳到蘋(píng)果的App Store進(jìn)行銷售。</p><p>  通過(guò)比較Android和iPhone OS的最新系統(tǒng):Android 2.2 Froyo和iOS4,我們可以了解下開(kāi)放式和封閉式的智能手機(jī)操作

86、系統(tǒng)的主要特點(diǎn)。雖然兩個(gè)操作系統(tǒng)的整體思路和功能設(shè)計(jì)有很大的不同,它初略分辨出哪一個(gè)更好一點(diǎn)。</p><p><b>  第二章 智能手機(jī)</b></p><p>  2.1 Android</p><p>  Android系統(tǒng)的體系結(jié)構(gòu)由5層,從底部到頂部分別是Linux內(nèi)核,Android運(yùn)行庫(kù),應(yīng)用框架和應(yīng)用程序。Android提

87、供的核心服務(wù),如安全,內(nèi)存管理,進(jìn)程管理,網(wǎng)絡(luò)堆棧和驅(qū)動(dòng)器,是基于Linux2.6的。作為軟件和硬件層之間的抽象層,Linux內(nèi)核隱藏硬件執(zhí)行的細(xì)節(jié),并為上層提供綜合服務(wù)。</p><p>  Dalvik虛擬機(jī)和Java核心庫(kù)都包含在Android運(yùn)行層,提供Java核心庫(kù)的大多數(shù)功能。這些庫(kù)包含了應(yīng)用于Android組件的一系列C/C++庫(kù)。這些庫(kù)集成了應(yīng)用框架層,然后提供給開(kāi)發(fā)人員。</p>

88、<p>  應(yīng)用程序框架層為程序的初始化提供了各種模塊,以簡(jiǎn)化元件的使用,讓開(kāi)發(fā)商為所欲為,并提供其他服務(wù)軟件,當(dāng)然,在安全性上有所限制。</p><p>  主流應(yīng)用程序位于應(yīng)用層,包括電子郵件,短信,日歷,谷歌地圖,網(wǎng)頁(yè)瀏覽器和接觸。用戶可以直接與此層交互。</p><p>  Android的最新版本的Android 2.2 Froyo,提出一些新的特點(diǎn)。它們是:1.支持1

89、0.1版本的Flash,使用戶可以在手機(jī)上觀看Flash。2.網(wǎng)頁(yè)瀏覽器中的V8 JavaScript引擎使得互聯(lián)網(wǎng)數(shù)據(jù)傳輸更加迅速。 3.在網(wǎng)絡(luò)共享上有大的進(jìn)步。你可以將手機(jī)作為3G網(wǎng)卡或?qū)?G信號(hào)轉(zhuǎn)換為Wi-Fi信號(hào)。 4.支持自動(dòng)軟件更新。5.軟件可安裝到SD卡以擴(kuò)展儲(chǔ)存空間。</p><p>  2.2 iPhone</p><p>  iPhone OS是由

90、4個(gè)抽象層組成:核心OS,核心服務(wù),媒體和Cocoa Touch。</p><p>  核心操作系統(tǒng)和核心服務(wù)層使用C語(yǔ)言設(shè)計(jì),來(lái)處理核心系統(tǒng)服務(wù),使開(kāi)發(fā)人員能夠執(zhí)行文件訪問(wèn),socket請(qǐng)求和數(shù)據(jù)處理。 CFNetwork和SQLite同樣是這2層一部分。</p><p>  媒體層,根據(jù)其名稱,是用來(lái)控制視頻和音頻,以及處理二維和三維圖像。這一層中的Open GL-ES Qu

91、ratz部分是用C語(yǔ)言編碼,而音頻核心和動(dòng)畫(huà)核心的一部分則是基于Objective C編寫(xiě)。</p><p>  Cocoa Touch層,在iPhone上為應(yīng)用程序建立了一個(gè)基本框架。大多數(shù)程序運(yùn)行在Cocoa Touch層,它也是基于Objective C編寫(xiě)。</p><p>  最新的iPhone操作系統(tǒng)是iOS4。它包括以下新的特點(diǎn):1.軟件分類。這功能可以使用戶將不同分類的軟件

92、放入不同的文件中,使它更便于管理。 2。電子郵件整合。一個(gè)賬戶可以使用不同供應(yīng)商的電子郵件服務(wù)。 3。 iBook,源于iPad的軟件,將內(nèi)置于iOS。 4。一個(gè)全新的蘋(píng)果游戲中心,使iPhone成為一個(gè)巨大的娛樂(lè)平臺(tái)。</p><p>  2.3 Android vs. iPhone</p><p>  作為智能手機(jī)操作系統(tǒng)中最頂尖的兩個(gè),我們相

93、信,Android和iPhone都各有自己的優(yōu)勢(shì)和缺點(diǎn)。現(xiàn)在,讓我們一起來(lái)看看這兩個(gè)系統(tǒng),看到它們有什么獨(dú)特的功能。</p><p>  Android 2.2 Froyo完全支持多任務(wù),這意味著你可以一邊聽(tīng)音樂(lè),寫(xiě)博客。而iOS 4,正式宣布其為“多任務(wù)運(yùn)行”,而事實(shí)上,這只是一個(gè)概念手法的運(yùn)用。只有少數(shù)被蘋(píng)果授權(quán)的軟件可以同時(shí)運(yùn)行,多任務(wù)原則更是容易得多,當(dāng)一個(gè)應(yīng)用程序轉(zhuǎn)出時(shí),其當(dāng)前狀態(tài)被保存好,然后系統(tǒng)關(guān)閉

94、它。當(dāng)它又被轉(zhuǎn)換進(jìn)來(lái)時(shí),我們又回到了其以前的快照。</p><p>  在Android 2.2 Froyo公布時(shí),谷歌宣稱其擁有最流暢的網(wǎng)絡(luò)瀏覽器,因?yàn)槭褂玫腣8 JavaScript引擎。 V8是一個(gè)全新的引擎,為運(yùn)行龐大的JavaScript應(yīng)用程序而設(shè)計(jì)。在一些測(cè)試中,V8的速度要比Internet Explorer的JScript,火狐的SpiderMonkey和Safari的Jav

95、aScriptCore更加迅速。這一切都?xì)w功于 V8的3個(gè)關(guān)鍵部件,他們可以快速訪問(wèn)屬性,動(dòng)態(tài)生成代碼,有效進(jìn)行垃圾的清理。</p><p>  2.3.1 快速屬性訪問(wèn)</p><p>  JavaScript是一種動(dòng)態(tài)語(yǔ)言,這意味著屬性可以在運(yùn)行時(shí)進(jìn)行添加或刪除,并且它們會(huì)經(jīng)常改變。大多數(shù)JavaScript引擎使用一種字典式結(jié)構(gòu)來(lái)存儲(chǔ)對(duì)象的屬性,因此它需要全局搜索以在內(nèi)存

96、中找到的屬性的位置.It相當(dāng)?shù)托У膶傩缘奈恢?。這是相當(dāng)?shù)托У那冶菾ava和Smalltalk慢。</p><p>  為了解決這個(gè)問(wèn)題,V8廢棄了動(dòng)態(tài)搜索,并以不同的方式實(shí)現(xiàn):動(dòng)態(tài)的創(chuàng)建對(duì)象的隱藏類。在JavaScript中,每次當(dāng)我們?yōu)閷?duì)象加入一個(gè)新的屬性,我們會(huì)從隱藏類中創(chuàng)建帶有新的屬性的子類作為超類。這是一個(gè)遞歸過(guò)程,且上述過(guò)程只有當(dāng)我們第一次做時(shí)出現(xiàn)。然后,當(dāng)在相同的情況下,我們只是使用以前的隱藏的子類。

97、因此,沒(méi)有必要重復(fù)操作,并創(chuàng)建一個(gè)字典。這會(huì)保存時(shí)間和精力,以及更容易執(zhí)行類的優(yōu)化和內(nèi)部緩存。</p><p>  2.3.2 動(dòng)態(tài)代碼生成</p><p>  當(dāng)JavaScript每次首回運(yùn)行時(shí),V8將把它直接轉(zhuǎn)換為本地機(jī)器代碼,而不是解釋為字節(jié)碼。屬性的訪問(wèn)是通過(guò)內(nèi)部緩存,它通常在運(yùn)行時(shí)被翻譯成V8的指令。</p><p>  當(dāng)它來(lái)訪問(wèn)某些對(duì)象的代碼時(shí),V

98、8引擎試圖找到當(dāng)前的隱藏類。同時(shí),V8假設(shè)在代碼中的所有對(duì)象都是相同的隱藏類,所以V8將修改相應(yīng)的內(nèi)部緩存,使隱藏類更方便地直接使用。如果這假設(shè)是正確的,屬性的訪問(wèn)可以使用1個(gè)指令就全部完成。即使預(yù)測(cè)失敗,V8會(huì)再次修改內(nèi)部緩存,這不會(huì)花費(fèi)太多的時(shí)間和資源。</p><p>  當(dāng)一個(gè)隱藏類是被很多的對(duì)象共享,存取速度可以接近最具活力的語(yǔ)言的訪問(wèn)速度。內(nèi)部緩存和隱藏類,混合動(dòng)態(tài)代碼和類優(yōu)化,在大規(guī)模地改善Java

99、Script效率。</p><p>  2.3.3 有效的垃圾清理機(jī)制</p><p>  V8引擎會(huì)對(duì)內(nèi)存進(jìn)行自動(dòng)回收。為了保證對(duì)象的分配速度,以及削減垃圾清理和內(nèi)存碎片清理的時(shí)間,在執(zhí)行垃圾清理時(shí),V8會(huì)中斷正在運(yùn)行的應(yīng)用程序。大多數(shù)情況下只有一小部分對(duì)象的堆棧參與垃圾清潔周期,所以中斷造成小。所有的對(duì)象和指針的位置都會(huì)被V8記錄,這樣系統(tǒng)將不會(huì)采取對(duì)象的指針和內(nèi)存溢出將會(huì)避免。&l

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論