Mobile devices have become a necessity for many people around the world. The ability to keep in touch with family and business partners or to share data in real time are only a few of the reasons for the increasing importance of mobile devices. The flip side of this global trend is related with battery consumption. Smartphones are evolving from the past ten years with faster CPUs, cheaper and bigger storage, and higher-quality displays. However, battery technology did not improve at the same pace. The two biggest causes for battery consumption on mobile devices are related with the display and network traffic. The display is a major mobile phone energy hog, that can be softened by reducing its brightness and timeout. Network operations are unavoidable in today’s clouds world where everything is a service. Mobile devices need to communicate to achieve usefulness whether to transmit data over the Internet or to share data with another device. Therefore, developers followed best practices to reduce the amount of network operations in order to increase the battery’s life. Basically they all resume to the following four best practices : Consider first the need to perform a network call right now. Alternatives are pulling the service at regular intervals or allowing the server to push the data down to the client. Consider how much data you need to retrieve. It is possible to use different types of caches (e.g., response cache introduced for HttpUrlConnection in Android 4/ICS) and retrieving smaller pages of data from the service will greatly reduce your application’s network traffic. Use transparent compressions (supported by HttpUrlConnection class) verifying that the data retrieved from the server is gzip-compressed. © Ricardo Queirós; licensed under Creative Commons License CC-BY 3 rd Symposium on Languages, Applications and Technologies (SLATE’14). Editors: Maria João Varanda Pereira, José Paulo Leal, and Alberto Simões; pp. 93–100 OpenAccess Series in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 94 JSON on Mobile: is there an Efficient Parser? Choose a better data format, which usually involves a balance between size optimization and how dynamic the format is. If you can, choose a format that allows you to extend your data definition without losing backward-compatibility. There are several solutions such as XML, YAML, JSON, Protobuf, and others. The last recommendation touches in a very important factor data transmission over the Internet. In a communication process it is necessary to transform data into a format that is suitable for transmission over the network and that allows the recipient to consume it without any problems. This technique is called serialization. In the context of data storage and transmission, serialization is the process of writing an object to a stream of bytes. That stream can then be sent through a socket, stored to a file and/or database or simply manipulated so that this exact same memory representation can be read later. This last process is called deserialization. In the serialization realm, XML was used as the standard language for data representation.
This paper presented a comparison on the use of a set of JSON libraries within a mobile application. When comparing serialization libraries on a mobile platform, it is necessary to S L AT E 2 0 1 4 100 JSON on Mobile: is there an Efficient Parser? Figure 2 Java JSON libraries benchmark. consider the most important aspects for this environment, such as data size and serialization speed. In this paper we focus on the performance facet. The main contribution of this paper is two-fold: a survey on serialization formats organized by types: textual and binary; a performance benchmark that could be important for others that need to select an efficient parser for mobile communication. Based on the benchmark results one can conclude that Jackson showed the best combined results. However, if your mobile app will only deserialize data, minimal-json offers the best performance in the experiment.
2 Codehaus. High-performance json processor. http://jackson.codehaus.org/, 2013. [Online; accessed 06-May-2014].
3 Erik Hellman. Android Programming – Pushing the limits. Wiley, 2013.
4 K. Maeda. Performance evaluation of object serialization libraries in XML, JSON and binary formats. In Digital Information and Communication Technology and its Applications (DICTAP), 2012 Second International Conference on, pages 177–182, May 2012.
5 Audie Sumaray and S. Kami Makki. A comparison of data serialization formats for optimal efficiency on a mobile platform. In Proceedings of the 6th International Conference on Ubiquitous Information Management and Communication, ICUIMC’12, pages 48:1–48:6, New York, NY, USA, 2012. ACM.
6 Wikipedia. Comparison of data serialization formats. http://en.wikipedia.org/wiki/ Comparison_of_data_serialization_formats, 2014. [Online; accessed 15-April-2014].