<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Thanks for the patch and for pointing out that numbits can be
resolved in compile time. We will whoever not include this patch
since we are working with a major rewrite and optimization of the
per and uper backends and will address this and other opportunities
for optimization in a different way, but with the same principle
of moving calculations to compile time as much as possible.<br>
<br>
Thank you for your contribution!<br>
<br>
<br>
<div class="moz-cite-prefix">On 09/24/2012 06:05 PM, Jeremy Heater
wrote:<br>
</div>
<blockquote
cite="mid:CADLoKj0k0k4oY4Ks80TFTHbQoar0wrX5vzoFgB=hLzq7y-itSw@mail.gmail.com"
type="cite">
<div class="ajy"><img moz-do-not-send="true" 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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-patches mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-patches@erlang.org">erlang-patches@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-patches">http://erlang.org/mailman/listinfo/erlang-patches</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
/Henrik Nord Erlang/OTP</pre>
</body>
</html>