Protocol Buffers中的optimize_for选项
http://code.google.com/apis/protocolbuffers/docs/proto.html#options
optimize_for(file option): Can be set toSPEED,CODE_SIZE, orLITE_RUNTIME. This affects the C++ and Java code generators (and possibly third-party generators) in the following ways:SPEED(default): The protocol buffer compiler will generate code for serializing, parsing, and performing other common operations on your message types. This code is extremely highly optimized.CODE_SIZE: The protocol buffer compiler will generate minimal classes and will rely on shared, reflection-based code to implement serialialization, parsing, and various other operations. The generated code will thus be much smaller than withSPEED, but operations will be slower. Classes will still implement exactly the same public API as they do inSPEEDmode. This mode is most useful in apps that contain a very large number.protofiles and do not need all of them to be blindingly fast.LITE_RUNTIME: The protocol buffer compiler will generate classes that depend only on the "lite" runtime library (libprotobuf-liteinstead oflibprotobuf). The lite runtime is much smaller than the full library (around an order of magnitude smaller) but omits certain features like descriptors and reflection. This is particularly useful for apps running on constrained platforms like mobile phones. The compiler will still generate fast implementations of all methods as it does inSPEEDmode. Generated classes will only implement theMessageLiteinterface in each language, which provides only a subset of the methods of the fullMessageinterface.
option optimize_for = CODE_SIZE;
浙公网安备 33010602011771号