I’m parsing a big XML file using SAXParser in Android and was wondering if there’s a faster way of doing string comparisons? I’ve heard rumours that you can use the Dalvik VM to do something which will save memory allocated and hence speed it all up, but I can’t find anything online.
Can anyone point me in the right direction to either use Dalvik to speed up my parsing or a better, faster way of doing XML parsing?
String’s compareTo() method is implemented internally in dalvik as a special hand-crafted assembly routine. It’s unlikely you’ll be able to beat its performance for string comparisons
If this is an xml file that you are downloading, I don’t know of any way to speed up your parsing time. However, if you can include it in the apk as a resource (in the res/xml folder), then it will be compiled into Android’s binary xml format when you build the apk, and you can access it via XmlResourceParser, which should be significantly faster