<div class="ajy"><img class="ajz" id=":1ir" tabindex="0" src="images/cleardot.gif" alt=""></div>Hello,<br><br><font>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).<i><br></i>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).<br>
</font><br>git fetch git://<a href="http://github.com/Kwisatx/otp.git" target="_blank">github.com/Kwisatx/otp.git</a> move_num_bits_call_to_compilation<br><div id=":149"><br><a href="https://github.com/Kwisatx/otp/compare/maint...move_num_bits_call_to_compilation" target="_blank">https://github.com/Kwisatx/otp/compare/maint...move_num_bits_call_to_compilation</a><br>
<a href="https://github.com/Kwisatx/otp/compare/maint...move_num_bits_call_to_compilation.patch" target="_blank">https://github.com/Kwisatx/otp/compare/maint...move_num_bits_call_to_compilation.patch</a><br><br>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).<br>
<br>Best regards,<br>
Jeremy Heater.<br><br>PS: here's the ASN.1 grammar I used to test:<br>
<br>NumBitsBench DEFINITIONS AUTOMATIC TAGS ::= BEGIN<br>TestType ::= SEQUENCE {<br>a SEQUENCE (SIZE (1..1000)) OF INTEGER(0..1000),<br>b SEQUENCE (SIZE (1..100000)) OF INTEGER(0..100000),<br>c SEQUENCE (SIZE (1..10000000)) OF INTEGER(0..10000000),<br>
d SEQUENCE (SIZE (1..1000000000)) OF INTEGER(0..1000000000),<br>e SEQUENCE (SIZE (1..100000000000)) OF INTEGER(0..100000000000)<br>} END<i><br></i></div>