These two things are essentially different, JAXB called the OX binding tool, XStream should be counted as a serialization tool, but the OX binding tool also Marshall and Unmarshall, so it contains the serialization part. The serialization tool does not necessarily need to provide binding functionality. Now that you're playing with serialization, simply compare the two of them in terms of serialization.
Jaxb:toplink JAXB 10133, which should be the JAXB 1.1 standard (canceling the validation function of the schema)
xstream:1.3.1
Data length:
|
length |
content |
351 |
<com.oocl.frm.ws.sample.employee> <name>liufei</name> <age>40</age <address> <street>zhaojiabang</street> <country>China< /country> <city>shanghai</city> <doornum>789</doornum> & Lt;empname>afka liu</empname> </address> <salary>20000.0</salary> <isactive>false</isactive> <sexy>f</sexy> </ Com.oocl.frm.ws.sample.employee> |
589 (has removed white spaces) |
<?xml version= "1.0" encoding= "UTF-8" <ns0:employee xsi: schemalocation= "HTTP://WWW.OOCL.COM/FRM/WS/JAXB" xmlns:xs= "Http://www.w3.org/2001/XMLSchema" xmlns:ns0= "http://" Www.oocl.com/frm/ws/jaxb "xmlns:xsi=" Http://www.w3.org/2001/XMLSchema-instance "><ns0:name>liufei</ Ns0:name><ns0:age>40</ns 0:age><ns0:salary>20000.0</ns0:salary><ns0:sexy>f< /ns0:se xy><ns0:isactive>false</ns0:isactive><ns0:address><ns0:st Reet>Zhaojiabang </ns0:street><ns0:country>China</ns0:country>;<ns0:city>shanghai</ns0:city>< ns0:doornum>789</ns0:doornum& Gt;<ns0:empname>afka liu</ns0:empname></ns0:address> </ns0:employee> |
Time: Serialization and deserialization 1 million times.
Type |
Serialization (MS) |
Anti-serialization (MS) |
Xstraem |
90148 |
135878 |
TopLink JAXB |
34872 |
56557 |