Optimization tips and recommendations for parsing xml on ios

I am looking for optimization tips and tricks for parsing xml on ios. I am currently using KissXML in one of my projects to parse messages at approximately 50 Hz. With this speed, I can clearly see that the high loading load for processing messages even with relatively short messages (about 10 elements).

One of the optimization strategies is, of course, choosing the β€œright” parser. A detailed comparison of the available parsers for ios can be found here http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project .

However, I am currently trying to explore general guidelines and tips on how to optimize with payloads to improve performance. Hope the experts have something about this! Any individual or partial advice is greatly appreciated.

+4
source share
1 answer

As for tips that are not directly related to XML parsing, but it will still help you in this task:

  • Parsing in the background thread can easily help you. With GCD, you can also prioritize the stream.
  • You can use the technique of this Apple document. On page 14 you can read:

Using the ForSelector method: to bypass dynamic binding, most of the time required for messaging is saved. However, the savings will be significant only when a particular message is repeated many times, as in the for loop shown above.

I really used this method when setting the value for an array of objects, and I was able to get an improvement of 0.7 seconds. Maybe not a lot, but in more difficult and repetitive tasks I really think that this will change the situation.

0
source

All Articles