# PSON: A Serialization Format for IoT Sensor Networks
## 5 Research Results
### Encoding Sizes  
These are the results obtained after encoding each Test# payload with each library. These values are important because microcontrollers are commonly used in low-bandwidth or mesh networks. In these scenarios, sending a message through the net has a high cost in terms of network capacity. Furthermore, sending or receiving a larger message uses more of the network interface, so the device consumes more power. As described in the serialization/deserialization speed section, this is very important when devices are powered by batteries. In these tests, the lower the value, the better. Figure 7 includes the results for Avro, Thrift, and YAML, although they were not used in the microcontrollers. Avro, Thrift, and YAML messages were serialized using Java on a computer, and their serialized sizes were measured for each test. All results are shown in bytes. Figure 7 shows the size values for each serialization protocol. The above evaluation results for encoding time, encoding size, and binary size increase indicate that PSON is quite an efficient mechanism for embedded systems. According to the encoding time, PSON is one of the fastest formats for completing the encoding/decoding tests for ESP32 (Figure 3), followed by Protocol Buffers or MessagePack. Compared to MessagePack (another schema-less format, similar to PSON), PSON is much faster on average: 33% faster encoding and 55% faster decoding. On Arduino UNO, as shown in Figure 4, it encodes 40% faster on average, but deserialization is around 47% slower. Thus, PSON is quite efficient when encoding information on microcontrollers, which is the normal scenario in IoT, where devices send information periodically to the cloud. From the encoding size results in Figure 7, the most efficient means of encoding information in these tests was obtained with Protocol Buffers or Apache Thrift, but this is only suitable for use cases in which the message structure is known beforehand by both the microcontroller and the server decoding the messages. However, this is not the standard scenario in the IoT ecosystem, as it will require creating custom decoding functions in the cloud for every message sent by the device, which typically implies the compilation of the format definition, the use of the generated source files, etc. This is not practical or sustainable in the long term when dealing with multiple device types or changes in the protocol, which may result in versioning complexity. Moreover, it complicates the cloud inter-operability required in IoT with third-party services or applications, which usually work over the well-known REST API schema, using JSON as the standard encoding format. Figure 6: Arduino binary size increase. Among the other schema-less encoding formats that can be directly converted to JSON, PSON is one of the most efficient methods and is comparable to MessagePack, obtaining quite similar results for encoding size. On average, PSON and MessagePack generate payloads that are 15% smaller than a raw JSON, but depending on the payload, it can be improved by 30-40%, i.e., in Test01 and Test06. Finally, the increases in binary size due to serialization/deserialization in Figures 5 and 6 illustrate that the ArduinoJSON library, which provides serialization/deserialization for JSON and MessagePack, is quite an optimized library in this respect, leading with a smaller program footprint in both ESP32 and Arduino UNO. The PSON library is quite similar to ESP32, with a 20.26% increase above the baseline binary versus the 20.15% required for MessagePack or 20.21% required for JSON. For Arduino UNO, PSON is less optimized and results in a 10% greater footprint on average against Arduino JSON. In sum, PSON is a new encoding format that competes with MessagePack in terms of encoding size but improves the serialization time by using a simpler encoding approach. It outperforms other schema-less encoding systems such as JSON, XML, and BSON in both serialization size and time.