久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何加快 Android XML 解析速度?

How Can I Speed Up Android XML Parsing?(如何加快 Android XML 解析速度?)
本文介紹了如何加快 Android XML 解析速度?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問題描述

下午好(取決于你住在哪里)!

Good afternoon (depending on where you live)!

我對(duì) Android 開發(fā)還很陌生,目前我正在努力將功能從現(xiàn)有的 iOS 應(yīng)用程序轉(zhuǎn)移到 Android 上.此功能的一部分是解析包含大約 500 個(gè)條目的大"(約 13,000 行)RSS XML 文件.我花了 10 到 15 個(gè)小時(shí)研究 Android 上的 XML 解析并嘗試了主要的 XML 解析器:DOM、SAX 和 Pull-parsing.這是我的結(jié)果,在我的機(jī)器上的模擬器中運(yùn)行(32 位 Windows Vista,2.2 GHz 雙 CPU,3 GB RAM):

I'm fairly new to Android development and I'm currently working on moving the functionality from an existing iOS app to Android. Part of this functionality is to parse a "large" (~13,000 line) RSS XML file that contains about 500 entries. I've spent anywhere from 10-15 hours researching XML parsing on Android AND trying out the major XML parsers: DOM, SAX, and Pull-parsing. Here are my results, running within' the emulator on my box (32-bit Windows Vista, 2.2 GHz Dual CPU, 3 GB RAM):

SAX:~6:00 分鐘

SAX: ~6:00 minutes

拉解析:~4:00 分鐘

Pull-Parsing: ~4:00 minutes

DOM:超過 4:00 分鐘,但在我對(duì)該實(shí)現(xiàn)進(jìn)行編碼時(shí)沒有計(jì)時(shí).

DOM: Greater than 4:00 minutes, but didn't time it when I had that implementation coded.

我也試過這個(gè)來(lái)自 github 的 RSS 閱讀器,但花了 >10:00 分鐘:

I also tried this RSS Reader from github, but it took >10:00 minutes:

https://github.com/matshofman/Android-RSS-Reader-Library

SAX、PP 和 DOM 的實(shí)現(xiàn)都取自 stackoverflow.com 線程,所以我很有信心我沒有在其中做任何非標(biāo)準(zhǔn)的事情(不過,我不排除這種可能性).我決定吸引更多、更有經(jīng)驗(yàn)的人群來(lái)了解我還可以嘗試什么.

The implementations for the SAX, PP, and DOM were all taken from stackoverflow.com threads, so I feel fairly confident that I didn't do anything non-standard in them (though, I'm not ruling that out). I've decided to appeal to a larger, more experienced, crowd to get some ideas of what else I can try.

我無(wú)法控制文件的格式.如果我要實(shí)現(xiàn)這種端到端,我只需編寫一個(gè) Web 服務(wù),它會(huì)在服務(wù)器上完成所有繁重的工作,然后發(fā)送一個(gè)小的、緊湊的 JSON 序列化列表.相反,我有 13K 行文件.:)

I don't have any control over the format of the file. If I was implementing this end-to-end, I would just write a Web Service that did all the heavy-lifting on the server and then sent down a small, compact, JSON-serialized list. Instead, I have the 13K line file. :)

對(duì)我能做什么有任何見解嗎?這似乎是一個(gè)相當(dāng)普遍的問題,但大多數(shù)回復(fù)只是說(shuō)嘗試使用不同的主要 XML 解析器之一.就我而言,我已經(jīng)嘗試了所有三個(gè),即使是最快的也似乎太慢了.

Any insight into what I can do? It seems to be a fairly common problem, but most responses just say to try one of the different main XML parsers. In my case, I've tried all three and even the fastest seems way too slow.

我做錯(cuò)了什么?在Android上通過網(wǎng)絡(luò)進(jìn)行XML解析時(shí),人們通常會(huì)遇到什么正常的新手"問題???

What am I doing wrong? Are there any normal "newbie" problems that people usually encounter when doing XML parsing over the network on Android???

提前感謝您提供的任何幫助!

Thank you in advance for any help you can provide!

推薦答案

使用vtd-xml.

這里有一些基準(zhǔn)測(cè)試.

此外,模擬器速度極慢,因此請(qǐng)?jiān)谡鎸?shí)設(shè)備上嘗試一下,您可能會(huì)看到很大的改進(jìn).

Also, the emulator is extremely slow, so try it on a real device and you will likely see great improvements.

這篇關(guān)于如何加快 Android XML 解析速度?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Upload progress listener not fired (Google drive API)(上傳進(jìn)度偵聽器未觸發(fā)(Google 驅(qū)動(dòng)器 API))
Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 將文件保存在特定文件夾中)
Google Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 無(wú)效的 DriveId 和 Null ResourceId)
Google drive api services account view uploaded files to google drive using java(谷歌驅(qū)動(dòng)api服務(wù)賬戶查看上傳文件到谷歌驅(qū)動(dòng)使用java)
Google Drive service account returns 403 usageLimits(Google Drive 服務(wù)帳號(hào)返回 403 usageLimits)
com.google.api.client.json.jackson.JacksonFactory; missing in Google Drive example(com.google.api.client.json.jackson.JacksonFactory;Google Drive 示例中缺少)
主站蜘蛛池模板: 欧美一区中文字幕 | 精品久久久久久久人人人人传媒 | 日韩视频在线一区 | 欧美日韩高清在线一区 | 国产精品一区二区无线 | 国内精品视频在线观看 | 国产色婷婷精品综合在线手机播放 | 一级全黄少妇性色生活免费看 | 91精品一区二区三区久久久久 | 中文字幕亚洲欧美 | 91精品国产色综合久久不卡98 | 在线免费观看a级片 | 欧美一区二区三区 | 日本免费视频 | 欧美一级免费黄色片 | 亚洲性在线 | 91精品国产综合久久香蕉麻豆 | 久久综合九九 | 欧美日韩视频 | 亚洲第1页| 日本在线免费看最新的电影 | 麻豆久久久久 | 一区二区三区免费在线观看 | 亚洲一区av | 欧美亚洲国语精品一区二区 | 久久国产综合 | 日韩视频一区二区 | 亚洲高清免费 | 久久久久国产精品一区三寸 | 久久美女网 | 自拍偷拍视频网 | 美日韩精品 | 中文字幕a√ | 亚洲精品一区在线 | 久久精品视频免费观看 | 亚洲 欧美 日韩 在线 | 91视频免费观看 | 精品在线一区二区三区 | 中文字幕在线观看日韩 | 国产精品视频偷伦精品视频 | 一区二区三区视频免费观看 |