This project aims to benchmark existing ASN1 PER (Packed Encoding Rules) codecs in Rust.
The project currently includes the following UPER codecs:
- rasn v0.28
- asn1-codecs v0.7.2
- asn1rs v0.3.1
System configuration: Ubuntu 24.04, Rustc: 1.92.0, AMD Ryzen 5850U 32GB RAM.
For more details regarding ASN1 definition, refer to telco_sample.asn
This benchmark uses a generic telecom-inspired protocol with realistic features (~377 bytes encoded):
- CHOICE types (PDU with Request variant)
- ENUMERATED types (PriorityLevel, RecordType)
- OPTIONAL fields (timestamps, addresses, metadata)
- Variable-length SEQUENCE-OF (20 records)
- OCTET STRING fields (identifiers, payloads)
- Nested structures with BOOLEAN and INTEGER fields
| Codec | Encoding (µs) | Decoding (µs) |
|---|---|---|
| rasn | 37.1 | 6.6 |
| asn1-codecs | 5.7 | 4.9 |
| asn1rs | 2.5 | 2.9 |
For more details regarding ASN1 definition, refer to sample.asn
| Codec | Encoding (µs) | Decoding (µs) |
|---|---|---|
| rasn | 958 | 103 |
| asn1-codecs | 180 | 49 |
| asn1rs | 69 | 74 |
| Codec | Encoding (µs) |
|---|---|
| rasn | 459 |
| asn1-codecs | 52 |
| asn1rs | 37 |
To run the benchmarks, follow these steps:
cargo build
cargo bench
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
This project is licensed under the Apache Licence, version 2.0.