[雙語翻譯]--通信工程外文翻譯--基于不同數(shù)據(jù)傳輸格式對(duì)ajax實(shí)時(shí)性響應(yīng)影響的研究(原文)_第1頁
已閱讀1頁,還剩3頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、Analysis of the Efficiency of Data Transmission Format Based on Ajax Applications?Peng Wang, Xiaodong Wu, Huamin Yang Department of Computer Science and Technology, Changchun University of Science and Technology, 130022,

2、 Changchun ,Jilin, China e-mail: wpeng@cust.edu.cn ?Abstract- In order to shorten the response time from Ajax real-time applications as far as possible, the client can get data from server timely and users can obtain tim

3、elier and more quickly real-time information. Choosing proper data transmission format can effectively shorten the analyzing time, reduce data file redundancy, and bring much convenience to system development and mainte

4、nance. Experiments show that when analyzing JSON type data objects, the computer spend less time than XML data type and more time than HTML fragments, but with low file redundancy and more convenience for programming and

5、 maintaining. So in some cases, use JSON data type as transmission type will bring faster user experience, and cost on development and maintenance also can be reduced. Keywords-Data Transmission Format ? Ajax ? Efficienc

6、y ?Comparison I. INTRODUCTION In some real-time Web applications, Ajax (Asynchronous JavaScript and XML) does play an important role in these real-time applications due to its support for asynchronous transmissio

7、n and local refresh. Ajax consists of HTML, JavaScript, DHTML (Dynamical Hypertext Markup Language) and DOM [1] (Document Object Model) components. Since some Web applications require relatively high real-time data,

8、the client side does not refresh the entire page in the case of asynchronous real-time data transmission. Ajax has a variety of data formats to achieve the client and server communication. Common data exchange formats

9、 are HTML, XML, JSON, CSV (Comma Separated Values), GZIP. Among them HTML is a relatively simple data transfer format. XML as a generic markup language, has cross-platform, cross-language advantage.While, as for the

10、 new generation of plain text data format, JSON has a clear advantage in data exchange of Ajax application. Without considering the case of network transmission, there is an obvious difference in efficiency for comput

11、er to analyze objects of different data formats. This article will mainly explore and compare the consuming time on parsing data objects and size of generated data files based on HTML? XML and JSON data interchange fo

12、rmat especially. II. AJAX DATA TRANSMISSION FORMAT HTML?Hypertext Mark-up Language?is not only currently the most widely used network markup language, but also the main language constituting and describing a web page d

13、ocument. HTML text is a kind of descriptive text composed by HTML tags, in lightweight Ajax applications[2], client and server side exchange data usually in the form of HTML fragments when using HTML as transmis

14、sion format. XML[3]?Extensible Markup Language? which like HTML, all belong to SGML(Standard Generalized Markup Language).XML is a cross-platform, dependent on the content technology. XML is designed to transfer and c

15、arry data, not for performance or display of data, while HTML language is used to show data. Therefore, the focus of XML is that it explains what data is, and carries data information. Using a series of simple tags t

16、o describe the data, these markers can be a convenient tool to create data format used by server-side. The most basic form of a XML document includes statements, handling instructions (optional) and element. XML docu

17、ments are all starting from a root node, the root node contains a root element, and other elements must be included in the root element. Nested elements are called child elements, child elements can also contain child

18、 elements, and data can exist in both their child elements and properties. And, like XML, JSON [4] is also a kind of data format based on plain text. Since JSON is prepared for JavaScript, JSON data format is very sim

19、ple. JSON can be transmitted with a simple String, Number or Boolean type variable; you can also use an array, or a complex object. In practice, object data type is usually used for exchanging, while objects are tagg

20、ed by unordered {} which contains a series of key-value pair Key-Value in JSON. III. FACTORS THAT AFFECT THE REAL-TIME RESPONSE Without taking different performances of servers processing the data into account, factors

21、 affecting real-time response include: 1. Network transmission environment 2. Transmission and Parsing speed of different data formats. Because of Ajax’ s asynchronous transmission and local refresh features, and supp

22、osing transmission in the network environment keeps in a level, the difference on the transmission speed of different data formats is not obvious. However, different data formats produce different redundant 2011 Inter

23、national Conference of Information Technology, Computer Engineering and Management Sciences978-0-7695-4522-6/11 $26.00 © 2011 IEEE DOI 10.1109/ICM.2011.199 2652011 International Conference of Information Technology,

24、 Computer Engineering and Management Sciences978-0-7695-4522-6/11 $26.00 © 2011 IEEE DOI 10.1109/ICM.2011.199 2652011 International Conference of Information Technology, Computer Engineering and Management Sciences9

25、78-0-7695-4522-6/11 $26.00 © 2011 IEEE DOI 10.1109/ICM.2011.199 265} }); 'type' defines the way to get xml, 'url' is the location where the file to visit is, 'dataType' defines the file type

26、(in this case, it is xml type),and 'success' is the function when it successfully returns to call. When function returns, XML nodes will be parsed and the time cost on parsing will be recorded. The following

27、 is a manifestation of the parsing xml object: changchun 44.91285 120.37689 In the object, ‘ data’is a root node. While ‘ area’ ?’ xcoordinate’ ?’ ycoordinate’are all child nodes, which separately record location ? latit

28、ude ? and longitude information. C. JSON JQuery supplies getJSON() function to access JSON file: $.getJSON('CustomerOrders.js', function(data) { var StartTime = new Date(); $(“ #DataReslultDiv“ ).empty(); $.e

29、ach(data, function(i, item) { var Name = item['area']; var EndTime = new Date(); var txtHtml = “ “+i +“ :“+Name +“ :TimeSpan->“+(EndTime - StartTime) +“ “ ; $(“ #DataReslultDiv“ ).append(txtHtml); }); }); T

30、he first parameter is the function is the file name to be visited, and the second is the function to be executed when visit is successful. The value which the function returns is JSON type data format. In the function

31、JSON array elements will be parsed and the parsing time is also recorded. Single JSON type data object is: { “ area“: “ 2“ , “ xcoordinate“: “ 44.91285“ , “ ycoordinate“: “ 120.37689“} Environment for tests[8

32、]? CPU: AMD Athlon(tm) 64 X2 Dual-Core Processor TK-53? Memory:2G? OS:Windows XP sp 2. In large number of parser objects case, test one demonstrates the time which the computer spends on parsing ordinary HTML, XML an

33、d JSON object. Table I: Test one?The time consuming in large number of parsing objects case? HTML XML JSONObject Count 10000 10000 10000Total Time(ms) 308 25675 19484Average Time(ms) 0.030 2.567 1.948From test o

34、ne it is easy to see using Html as transmitting data format can get faster response time than XML and JSON data format [9]. For data quantity is little and data structure is not complex case, Html should be first selec

35、tion of data transmission format. Meanwhile, the computer parses JSON objects faster than XML objects. Though XML has very good generalization, in certain application environment using JSON as transmission data forma

36、t will shorten the response time. Test two records with increasing parsing object number cases (the number parsing object for 100, 500, 1000, 2000, 5,000 respectively) the cost of total and average time when the comp

37、uter parsing HTML fragment, XML and JSON objects. Table II: Test two?Time consuming on increasing parsing objects.? HTML XML JSONObject Count 100 100 100Total Time(ms) 14 176 119Average Time(ms) 0.14 1.76 1.19Obj

38、ect Count 500 500 500Total Time (ms) 30 912 648Average Time(ms) 0.150 1.806 1.296Object Count 1000 1000 1000Total Time(ms) 45 1789 1341Average Time(ms) 0.045 1.789 1.341Object Count 2000 2000 2000Total Time(ms)

39、98 3886 2550Average Time(ms) 0.049 1.943 1.275Object Count 5000 5000 5000Total Time(ms) 212 10922 8080Average Time(ms) 0.042 2.184 1.616From test two it can be seen paring single HTML object time doesn’ t increase

40、 with the number of parsing objects. When paring objects number is small (100,500 etc.), the computer will spend more time on HTML objects than other two data format. But when the node number increase (1000, 2000, and

41、 5000) single Html object parsing time consuming keep on the same level. And parsing one JSON object is faster than XML object. And XML object information redundancy is much bigger than JSON object. Below are compari

42、sons on file size in increasing number of parsing objects based on HTML, XML and JSON data format. Table III: File size comparison on different data format HTML XML JSONObject count 100 100 100File Size?KB? 7 16 8

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲(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)論