**need to merge 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/928 first**

ProtobufRoot.java is generated by protobufRoot.proto, 5000 lines.
it's only for unit test

- compare to jackson protobuf:
  - can parse protobuf 3 proto file
  - support protobuf 3: map/any

- compare to protoStuff runtime:
  - for a proto message type, not only support strong type(Pojo), but alse 
support weak type(Map)
  - support "any" type
  - support generic pojo type, eg:CustomGeneric<User>
  - **NOT** support List<List<XXX>>/List<Map<X, Y>> any more, because protobuf 
specification not support it, and the parser can not parse the proto file

- compare to standard protobuf:
  - extend "any" type, for standard not support cases, use "json" schema to 
codec it.

- compare to all:
  - just pojo, no need any code generation and annotation
  - one pojo can serialize to different version proto file to support different 
version server
  - support text data come from http,can serrialize from different data type
    - number fields (int32/int64 and so on)
      - number
      - String
      - String[]
    - string fields
      - string
      - string[]
    - bool fields
      - boolean
      - string
      - string[]
    - enum fields
      - enum
      - number
      - string
      - string[]
  
- performance compare:
```
1.protobuf
  in our real scenes
  business model never bind to transport, and can switch between different 
transport dynamically
  that means if we choose standard protobuf, must build protobuf models from 
business models each time
  so should be much slower than the test results

2.protoStuff
  some scenes, there is no field but have getter or setter, so we can not use 
unsafe to access field
  so we disable protoStuff unsafe feature

Empty:
               Protostuff     ScbStrong      ScbWeak        Protobuf       
Jackson        
ser time(ms)  :268            297            250            187            391  
          
ser len       :36             0              0              0              56   
          
deser time(ms):109            31             16             243            434  
          
deser-ser len :36             0              0              0              56   
          

Scalars:
               Protostuff     ScbStrong      ScbWeak        Protobuf       
Jackson        
ser time(ms)  :234            282            284            313            388  
          
ser len       :53             21             21             21             73   
          
deser time(ms):156            62             125            187            453  
          
deser-ser len :53             21             21             21             73   
          

SimpleList:
               Protostuff     ScbStrong      ScbWeak        Protobuf       
Jackson        
ser time(ms)  :234            281            286            172            422  
          
ser len       :68             32             32             32             88   
          
deser time(ms):219            94             106            251            485  
          
deser-ser len :68             32             32             32             88   
          

PojoList:
               Protostuff     ScbStrong      ScbWeak        Protobuf       
Jackson        
ser time(ms)  :313            359            344            172            543  
          
ser len       :56             20             20             20             76   
          
deser time(ms):246            127            174            281            609  
          
deser-ser len :56             20             20             20             76   
          

Map:
               Protostuff     ScbStrong      ScbWeak        Protobuf       
Jackson        
ser time(ms)  :408            489            514            482            388  
          
ser len       :92             54             54             54             56   
          
deser time(ms):515            375            423            737            359  
          
deser-ser len :92             54             54             54             56   
          

Mixed:
               Protostuff     ScbStrong      ScbWeak        Protobuf       
Jackson        
ser time(ms)  :549            721            708            543            563  
          
ser len       :161            127            127            127            125  
          
deser time(ms):766            621            793            992            777  
          
deser-ser len :161            127            127            127            125  
          

```

[ Full content available at: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/930 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to