diff options
author | Björn Gustavsson <[email protected]> | 2012-12-12 12:20:22 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-12-19 11:52:12 +0100 |
commit | b8c35cfdb858cc68a40d21e58b54e2362f3a456a (patch) | |
tree | 12714552a8430888c0957de67456967f8dc87c68 /lib/asn1/src/asn1ct_gen_per.erl | |
parent | 1749a097ef9871124e6d2eecf2c6644f0c133fcc (diff) | |
download | otp-b8c35cfdb858cc68a40d21e58b54e2362f3a456a.tar.gz otp-b8c35cfdb858cc68a40d21e58b54e2362f3a456a.tar.bz2 otp-b8c35cfdb858cc68a40d21e58b54e2362f3a456a.zip |
per: Slightly optimize encoding of fixed OCTET STRINGs
Do the following optimizations:
* Optimize construction of OCTET STRINGs of size 2 by using
the 45 opcode instead of the 10 opcode for each character.
* Use exact comparison (implicit by matching) instead of '=='.
* Use list literals when more than one integer is added to a
list (e.g. [[45,16,2],...] instead of [45,16,2,...]). Results
in fewer BEAM instructions and less garbage.
* Cons instead of building a nested list when possible. Example:
[20,TempLen|TmpVal] instead of [20,TempLen,TmpVal].
* Omit the "2" opcode (align to byte boundary) before the "20" and
"21" opcodes (because they imply alignment).
* Assign the value to be encoded to a temporary variable, to avoid
calling element/2 more than once.
Diffstat (limited to 'lib/asn1/src/asn1ct_gen_per.erl')
0 files changed, 0 insertions, 0 deletions