[erlang-patches] ASN.1 Patch moving num_bits to compile-time

Jeremy Heater jeremy.heater@REDACTED
Mon Sep 24 18:05:54 CEST 2012


Hello,

Here is a proposed patch that moves asn1rt_uper_bin:num_bits/1 from the
runtime to the compile-time (from asn1rt_uper_bin to asn1ct_gen_per and
asn1ct_constructed_per).*
*The bit number information is added to the SizeConstraint and ValueRange
constraints when possible, and as another parameter in getchoice/3 and
set_choice/3 (now getchoice/4 and set_choice/4 for the uper encoding).

git fetch git://github.com/Kwisatx/otp.git move_num_bits_call_to_compilation

https://github.com/Kwisatx/otp/compare/maint...move_num_bits_call_to_compilation
https://github.com/Kwisatx/otp/compare/maint...move_num_bits_call_to_compilation.patch

I tested the patch with an example written to call heavily on the num_bits
function and got encouraging results (time measured with timer:tc to encode
was 5 to 15% faster, and to decode was 3 to 4 times faster with the patch).

Best regards,
Jeremy Heater.

PS: here's the ASN.1 grammar I used to test:

NumBitsBench DEFINITIONS AUTOMATIC TAGS ::= BEGIN
TestType ::= SEQUENCE {
a SEQUENCE (SIZE (1..1000)) OF INTEGER(0..1000),
b SEQUENCE (SIZE (1..100000)) OF INTEGER(0..100000),
c SEQUENCE (SIZE (1..10000000)) OF INTEGER(0..10000000),
d SEQUENCE (SIZE (1..1000000000)) OF INTEGER(0..1000000000),
e SEQUENCE (SIZE (1..100000000000)) OF INTEGER(0..100000000000)
} END*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20120924/36973582/attachment.htm>


More information about the erlang-patches mailing list