Skip to content

Commit e980e72

Browse files
committed
Docs: More README [ci skip]
1 parent a7621be commit e980e72

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,16 @@ $> pbjs -t static-module file1.proto file2.proto | pbts -o bundle.d.ts -
655655

656656
While using .proto files directly requires the full library respectively pure reflection/JSON the light library, pretty much all code but the relatively short descriptors is shared.
657657

658-
Static code, on the other hand, requires just the minimal library, but generates additional, albeit editable, source code without any reflection features.
658+
Static code, on the other hand, requires just the minimal library, but generates additional source code without any reflection features. This also implies that there is a break-even point where statically generated code becomes larger than descriptor-based code once the amount of code generated exceeds the size of the full respectively light library.
659659

660660
There is no significant difference performance-wise as the code generated statically is pretty much the same as generated at runtime and both are largely interchangeable as seen in the previous section.
661661

662+
| Source | Library | Advantages | Tradeoffs
663+
|--------|---------|------------|-----------
664+
| .proto | full | Easily editable<br />Interoperability with other libraries<br />No compile step | Some parsing and possibly network overhead
665+
| JSON | light | Easily editable<br />No parsing overhead<br />Single bundle (no network overhead) | protobuf.js specific<br />Has a compile step
666+
| static | minimal | Works where `eval` access is restricted<br />Fully documented<br />Small footprint for small protos | Can be hard to edit<br />No reflection<br />Has a compile step
667+
662668
### Command line API
663669

664670
Both utilities can be used programmatically by providing command line arguments and a callback to their respective `main` functions:

0 commit comments

Comments
 (0)