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

Henrik Nord henrik@REDACTED
Mon Nov 26 10:46:25 CET 2012


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.

Thank you for your contribution!


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
> erlang-patches@REDACTED
> 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/20121126/0ae88029/attachment.htm>


More information about the erlang-patches mailing list