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

Henrik Nord <>
Fri Sep 28 10:26:01 CEST 2012


Thank you for your contribution!
I have rebased your branch on the 'master' branch and included it in 
'master-pu'


On 09/24/2012 06:05 PM, Jeremy Heater wrote:
> 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 
> <http://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/
> /
>
>
> _______________________________________________
> erlang-patches mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-patches

-- 
/Henrik Nord Erlang/OTP

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20120928/2da02b88/attachment.html>


More information about the erlang-patches mailing list