diff options
author | Björn Gustavsson <[email protected]> | 2015-04-14 13:01:00 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-04-22 10:14:40 +0200 |
commit | 0971feb23d553bb51b04eb78fbf76c4bc19b4b93 (patch) | |
tree | 5cb0afafd88e42276c1518d11264dd2cf1bdf873 /lib/compiler/src/beam_dead.erl | |
parent | 32b85d920529990df2aa7acb091e7d03c520ef8c (diff) | |
download | otp-0971feb23d553bb51b04eb78fbf76c4bc19b4b93.tar.gz otp-0971feb23d553bb51b04eb78fbf76c4bc19b4b93.tar.bz2 otp-0971feb23d553bb51b04eb78fbf76c4bc19b4b93.zip |
v3_codegen: Reduce cost for fixing up bs_match_string instructions
Commit b76588fb5a introduced an optimization of the compile time of
huge functions with many bs_match_string instructions. The
optimization is done in two passes. The first pass coalesces adjacent
bs_match_string instructions. To avoid copying bitstrings multiple
times, the bitstrings in the instructions are combined in to a (deep)
list. The second pass goes through all instructions in the function
and combines the list of bitstrings to a single bitstring in all
bs_match_string instructions.
The second pass (fix_bs_match_string) is run on all instructions in
each function, even if there are no bs_match_instructions in the
function. While fix_bs_match_string is not a bottleneck (it is a
linear pass), its execution time is noticeable when profiling some
modules.
Move the execution of the second pass to the select_binary()
function so that it will only be executed for instructions that
do binary matching. Also take the opportunity to optimize away
uses of bs_restore2 that occour directly after a bs_save2. That
optimimization is currently done in beam_block, but it can be
done essentially for free in the same pass that fixes up
bs_match_string instructions.
Diffstat (limited to 'lib/compiler/src/beam_dead.erl')
0 files changed, 0 insertions, 0 deletions