Path: blob/main/third_party/leb128/README.md
6162 views
LEB128
LEB128 or Little Endian Base 128 is a form of variable-length code compression used to store an arbitrarily large integer in a small number of bytes. LEB128 is used in the DWARF debug file format and the WebAssembly binary encoding for all integer literals.
leb128 is used in pywasm, which the WebAssembly virtual machine.
Example
Performance
Since I used the most optimized algorithm, it is likely to be the fastest among all pure Python implementations of leb128. The detailed results can refer to the table, which is the result of using a very low-performance CPU.
| Case | Duration |
|---|---|
| U encode 1000000 times | 0.865 s |
| U decode 1000000 times | 0.808 s |
| I encode 1000000 times | 0.762 s |
| I decode 1000000 times | 0.835 s |
License
MIT