Build times almost doubling on every major release

Сергей Прохоров seriy.pr@REDACTED
Wed Jul 29 12:24:16 CEST 2020


erlc has an option to measure how much time each compilation step takes:
`erlc +time <erl file>`.

I tried it with your example:

OTP-23
```
time erlc +time test_pb.erl
Compiling "test_pb"
 remove_file                   :      0.000 s       3.3 kB
 parse_module                  :      0.577 s   14389.4 kB
<..>
 core                          :      0.660 s  110867.4 kB
 core_old_inliner              :      0.439 s  130500.1 kB
 sys_core_fold                 :      0.707 s   95544.3 kB
<..>
 v3_kernel                     :      0.592 s   85036.7 kB
<..>
 beam_ssa_bsm                  :      1.241 s   52211.4 kB
    %% Sub passes of beam_ssa_bsm from slowest to fastest:
    combine_matches            :      0.458 s  37 %
<..>
 beam_ssa_funs                 :      0.053 s   52211.4 kB
 beam_ssa_opt                  :     11.192 s   41673.2 kB
    %% Sub passes of beam_ssa_opt from slowest to fastest:
    ssa_opt_type_start         :      5.128 s  47 %
    ssa_opt_live               :      1.892 s  17 %
    ssa_opt_type_continue      :      1.667 s  15 %
    ssa_opt_dead               :      0.919 s   8 %
    ssa_opt_sink               :      0.506 s   5 %
<..>
 beam_ssa_recv                 :      0.050 s   41673.2 kB
 beam_ssa_pre_codegen          :      1.913 s   49962.4 kB
    %% Sub passes of beam_ssa_pre_codegen from slowest to fastest:
    live_intervals             :      0.468 s  25 %
    linear_scan                :      0.250 s  13 %
<..>
 beam_ssa_codegen              :      0.797 s   21962.5 kB
 beam_validator_strong         :      0.603 s   21962.5 kB
<..>
 save_binary                   :      0.001 s      55.7 kB
erlc +time test_pb.erl  21.69s user 1.67s system 102% cpu 22.685 total
```

and, eg, OTP-21:
```
time erlc +time test_pb.erl
Compiling "test_pb"
 remove_file                   :      0.000 s       3.3 kB
 parse_module                  :      0.588 s   14389.4 kB
<..>
 core                          :      0.632 s  110405.3 kB
 core_old_inliner              :      0.531 s  130242.5 kB
 sys_core_fold                 :      0.894 s   95317.8 kB
<..>
 v3_kernel                     :      0.721 s  114068.9 kB
 v3_codegen                    :      0.627 s   26703.4 kB
<..>
 save_binary                   :      0.000 s      55.7 kB
erlc +time test_pb.erl  8.39s user 0.48s system 111% cpu 7.980 total
```

OTP-22:
```
Compiling "test_pb"
 remove_file                   :      0.000 s       3.3 kB
 parse_module                  :      0.578 s   14389.4 kB
<..>
 core                          :      0.546 s  110405.3 kB
 core_old_inliner              :      0.449 s  129401.0 kB
 sys_core_fold                 :      0.768 s   95241.3 kB
<..>
 v3_kernel                     :      0.681 s  113407.6 kB
 beam_kernel_to_ssa            :      0.225 s   45635.5 kB
 beam_ssa_share                :      0.081 s   45375.4 kB
 beam_ssa_bsm                  :      1.157 s   49943.7 kB
    %% Sub passes of beam_ssa_bsm from slowest to fastest:
    combine_matches            :      0.404 s  35 %
<..>
 beam_ssa_funs                 :      0.049 s   49436.8 kB
 beam_ssa_opt                  :      4.938 s   44202.7 kB
    %% Sub passes of beam_ssa_opt from slowest to fastest:
    ssa_opt_live               :      1.259 s  27 %
    ssa_opt_type_continue      :      1.159 s  24 %
    ssa_opt_dead               :      0.879 s  19 %
    ssa_opt_type_start         :      0.649 s  14 %
<..>
 beam_ssa_recv                 :      0.049 s   44202.7 kB
 beam_ssa_pre_codegen          :      2.485 s   59314.1 kB
    %% Sub passes of beam_ssa_pre_codegen from slowest to fastest:
    live_intervals             :      0.710 s  29 %
<..>
 beam_ssa_codegen              :      0.989 s   23579.8 kB
<..>
 save_binary                   :      0.001 s      55.7 kB
erlc +time test_pb.erl  15.85s user 1.32s system 106% cpu 16.183 total
```

So it seems there were a lot of `beam ssa` optimization passes aded and
some of them are quite slow on large files.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200729/130798ae/attachment.htm>


More information about the erlang-questions mailing list