<div dir="ltr">Hello Sergei,<br><div><br>Your diagnostic does match what John Högberg mentioned in Erlanger Slack (#general channel) a few days ago - namely, that recent versions of OTP do much more aggressive optimizations.</div><div><br>On the bright side, it looks like OTP 24 will likely compile stuff faster - without necessarily compromising on said optimizations.</div><div><br></div><div>Cheers,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 29 Jul 2020 at 11:24, Ð¡ÐµÑ€Ð³ÐµÐ¹ ÐŸÑ€Ð¾Ñ…оров <<a href="mailto:seriy.pr@gmail.com">seriy.pr@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">erlc has an option to measure how much time each compilation step takes: `erlc +time <erl file>`.<div><br></div><div>I tried it with your example:</div><div><br></div><div>OTP-23</div><div>```</div><div><font face="monospace">time erlc +time test_pb.erl<br></font></div><div><font face="monospace">Compiling "test_pb"<br> remove_file Â  Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.000 s Â  Â  Â  3.3 kB<br> parse_module Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.577 s Â  14389.4 kB<br><..></font></div><div><font face="monospace"> core Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.660 s Â 110867.4 kB<br> core_old_inliner Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.439 s Â 130500.1 kB<br> sys_core_fold Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.707 s Â  95544.3 kB<br><..></font></div><div><font face="monospace"> v3_kernel Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.592 s Â  85036.7 kB<br><..></font></div><div><font face="monospace"> beam_ssa_bsm Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 1.241 s Â  52211.4 kB<br>  Â  %% Sub passes of beam_ssa_bsm from slowest to fastest:<br>  Â  combine_matches Â  Â  Â  Â  Â  Â : Â  Â  Â 0.458 s Â 37 %<br><..></font></div><div><font face="monospace"> beam_ssa_funs Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.053 s Â  52211.4 kB<br> beam_ssa_opt Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  11.192 s Â  41673.2 kB<br>  Â  %% Sub passes of beam_ssa_opt from slowest to fastest:<br>  Â  ssa_opt_type_start Â  Â  Â  Â  : Â  Â  Â 5.128 s Â 47 %<br>  Â  ssa_opt_live Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 1.892 s Â 17 %<br>  Â  ssa_opt_type_continue Â  Â  Â : Â  Â  Â 1.667 s Â 15 %<br>  Â  ssa_opt_dead Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.919 s Â  8 %<br>  Â  ssa_opt_sink Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.506 s Â  5 %<br><..><br> beam_ssa_recv Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.050 s Â  41673.2 kB<br> beam_ssa_pre_codegen Â  Â  Â  Â  Â : Â  Â  Â 1.913 s Â  49962.4 kB<br>  Â  %% Sub passes of beam_ssa_pre_codegen from slowest to fastest:<br>  Â  live_intervals Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.468 s Â 25 %<br>  Â  linear_scan Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.250 s Â 13 %<br><..></font></div><div><font face="monospace"> beam_ssa_codegen Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.797 s Â  21962.5 kB<br> beam_validator_strong Â  Â  Â  Â  : Â  Â  Â 0.603 s Â  21962.5 kB</font></div><div><font face="monospace"><..><br> save_binary Â  Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.001 s Â  Â  Â 55.7 kB<br>erlc +time test_pb.erl Â 21.69s user 1.67s system 102% cpu 22.685 total</font><br></div><div>```</div><div><br></div><div>and, eg, OTP-21:</div><div>```</div><div><font face="monospace">time erlc +time test_pb.erl<br>Compiling "test_pb"<br> remove_file Â  Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.000 s Â  Â  Â  3.3 kB<br> parse_module Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.588 s Â  14389.4 kB<br><..></font></div><div><font face="monospace"> core Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.632 s Â 110405.3 kB<br> core_old_inliner Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.531 s Â 130242.5 kB<br> sys_core_fold Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.894 s Â  95317.8 kB<br><..></font></div><div><font face="monospace"> v3_kernel Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.721 s Â 114068.9 kB<br> v3_codegen Â  Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.627 s Â  26703.4 kB<br><..></font></div><div><font face="monospace"> save_binary Â  Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.000 s Â  Â  Â 55.7 kB<br>erlc +time test_pb.erl Â 8.39s user 0.48s system 111% cpu 7.980 total</font><br></div><div>```</div><div><br></div><div>OTP-22:</div><div>```</div><div><font face="monospace">Compiling "test_pb"<br> remove_file Â  Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.000 s Â  Â  Â  3.3 kB<br> parse_module Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.578 s Â  14389.4 kB<br><..></font></div><div><font face="monospace"> core Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.546 s Â 110405.3 kB<br> core_old_inliner Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.449 s Â 129401.0 kB<br> sys_core_fold Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.768 s Â  95241.3 kB<br><..></font></div><div><font face="monospace"> v3_kernel Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.681 s Â 113407.6 kB<br> beam_kernel_to_ssa Â  Â  Â  Â  Â  Â : Â  Â  Â 0.225 s Â  45635.5 kB<br> beam_ssa_share Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.081 s Â  45375.4 kB<br> beam_ssa_bsm Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 1.157 s Â  49943.7 kB<br>  Â  %% Sub passes of beam_ssa_bsm from slowest to fastest:<br>  Â  combine_matches Â  Â  Â  Â  Â  Â : Â  Â  Â 0.404 s Â 35 %<br><..></font></div><div><font face="monospace"> beam_ssa_funs Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.049 s Â  49436.8 kB<br> beam_ssa_opt Â  Â  Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 4.938 s Â  44202.7 kB<br>  Â  %% Sub passes of beam_ssa_opt from slowest to fastest:<br>  Â  ssa_opt_live Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 1.259 s Â 27 %<br>  Â  ssa_opt_type_continue Â  Â  Â : Â  Â  Â 1.159 s Â 24 %<br>  Â  ssa_opt_dead Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.879 s Â 19 %<br>  Â  ssa_opt_type_start Â  Â  Â  Â  : Â  Â  Â 0.649 s Â 14 %<br><..></font></div><div><font face="monospace"> beam_ssa_recv Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.049 s Â  44202.7 kB<br> beam_ssa_pre_codegen Â  Â  Â  Â  Â : Â  Â  Â 2.485 s Â  59314.1 kB<br>  Â  %% Sub passes of beam_ssa_pre_codegen from slowest to fastest:<br>  Â  live_intervals Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.710 s Â 29 %<br><..></font></div><div><font face="monospace"> beam_ssa_codegen Â  Â  Â  Â  Â  Â  Â : Â  Â  Â 0.989 s Â  23579.8 kB<br><..></font></div><div><font face="monospace"> save_binary Â  Â  Â  Â  Â  Â  Â  Â  Â  : Â  Â  Â 0.001 s Â  Â  Â 55.7 kB<br>erlc +time test_pb.erl Â 15.85s user 1.32s system 106% cpu 16.183 total</font><br></div><div>```</div><div><br></div><div>So it seems there were a lot of `beam ssa` optimization passes aded and some of them are quite slow on large files.</div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Guilherme<br></div></div></div></div></div></div>