Benchmark of generated C source code from asn1c and asn1tools.
The asn1c executable is a lot bigger than asn1tools and asn1scc because it contains encode and decode functions for all codecs, not only uper as for asn1tools and asn1scc. There is no asn1c option to only generate uper code. asn1c also supports more ASN.1 construts and uses dynamic memory.
asn1tools:
text data bss dec hex filename 5553 560 8 6121 17e9 main
asn1scc:
text data bss dec hex filename 12073 560 8 12641 3161 main
asn1c:
text data bss dec hex filename 63733 4904 80 68717 10c6d main
Encoding and decoding the PDU type 1,000,000 times for each tool and optimization combination.
Tool | Optimization | Exexution time [s] |
---|---|---|
asn1tools | -O3 | 1.229 |
asn1tools | -Os | 2.987 |
asn1scc | -O3 | 4.023 |
asn1scc | -Os | 6.166 |
asn1c | -O3 | 10.902 |
asn1c | -Os | 12.569 |
asn1tools has the fewest lines of code, only 832. asn1scc has 3549 and asn1c 10159.
The statistics was created with cloc.
asn1tools:
------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 1 178 28 670 C/C++ Header 1 36 196 162 ------------------------------------------------------------------------------- SUM: 2 214 224 832 -------------------------------------------------------------------------------
asn1scc:
------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 4 697 126 3020 C/C++ Header 2 176 28 529 ------------------------------------------------------------------------------- SUM: 6 873 154 3549 -------------------------------------------------------------------------------
asn1c:
------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 34 1421 1822 8834 C/C++ Header 38 398 762 1325 ------------------------------------------------------------------------------- SUM: 72 1819 2584 10159 -------------------------------------------------------------------------------
The runtime memory usage was captured with Valgrind Massif on a 64 bits Ubuntu 16 machine.
asn1tools:
-------------------------------------------------------------------------------- n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) -------------------------------------------------------------------------------- 52 209,480 1,192 0 0 1,192 53 211,936 1,648 0 0 1,648 54 214,464 1,744 0 0 1,744 55 216,904 1,192 0 0 1,192 56 219,328 320 0 0 320 57 221,872 800 0 0 800 58 224,296 936 0 0 936 59 226,720 912 0 0 912 60 229,144 968 0 0 968 61 231,568 912 0 0 912 62 234,088 232 0 0 232 63 236,512 736 0 0 736 64 238,936 520 0 0 520 65 241,376 432 0 0 432 66 243,808 448 0 0 448 67 246,288 480 0 0 480 68 248,752 416 0 0 416 69 251,176 408 0 0 408
asn1scc:
-------------------------------------------------------------------------------- n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) -------------------------------------------------------------------------------- 52 209,480 1,192 0 0 1,192 53 211,936 1,648 0 0 1,648 54 214,464 1,744 0 0 1,744 55 216,904 1,192 0 0 1,192 56 219,328 320 0 0 320 57 222,240 1,168 0 0 1,168 58 224,664 1,224 0 0 1,224 59 227,088 1,440 0 0 1,440 60 229,512 1,672 0 0 1,672 61 232,120 248 0 0 248 62 234,544 720 0 0 720 63 236,968 536 0 0 536 64 239,424 432 0 0 432 65 241,856 448 0 0 448 66 244,336 480 0 0 480 67 246,800 416 0 0 416 68 249,224 408 0 0 408
asn1c:
-------------------------------------------------------------------------------- n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) -------------------------------------------------------------------------------- 59 226,712 1,192 0 0 1,192 60 229,168 1,648 0 0 1,648 61 231,696 1,744 0 0 1,744 62 234,128 256 0 0 256 63 236,552 280 0 0 280 64 238,976 1,056 596 92 368 65 241,400 1,464 903 185 376 66 243,824 1,888 920 208 760 67 246,264 2,632 920 208 1,504 68 248,688 2,784 920 208 1,656 69 251,112 2,584 920 208 1,456 70 253,600 2,000 920 208 872 71 256,048 1,584 743 121 720 72 258,608 400 0 0 400 73 261,080 1,368 262 50 1,056 74 263,560 1,832 434 54 1,344 75 265,984 2,224 524 92 1,608 76 268,408 2,232 536 104 1,592 77 270,880 2,464 579 109 1,776 78 273,304 2,568 643 181 1,744 79 275,792 2,704 689 231 1,784 80 278,232 1,944 719 217 1,008 81 280,680 2,536 920 256 1,360 82 283,104 1,712 920 256 536 83 285,632 1,072 481 63 528 84 288,056 520 0 0 520 85 290,544 1,600 0 0 1,600 86 292,968 488 0 0 488 87 295,392 480 0 0 480