diff options
author | Björn Gustavsson <[email protected]> | 2016-04-28 07:12:27 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-04-29 09:58:27 +0200 |
commit | 27098673c0654add1784852b54d4600a2775773e (patch) | |
tree | c3f030779cfb4f3bd31511b5be80c6b3f2e6f025 /lib/crypto | |
parent | 620676577bb80a41a991b52254b445589330a3da (diff) | |
download | otp-27098673c0654add1784852b54d4600a2775773e.tar.gz otp-27098673c0654add1784852b54d4600a2775773e.tar.bz2 otp-27098673c0654add1784852b54d4600a2775773e.zip |
Simplify and speed up del_ebin/1
It is faster and easier to use filename:split/1 and filename:join/1
than use four different 'filename' operations. Each call in the
original call first flattens the input list, and then traverse the
entire string to the end. So there are roughly 8 complete traversals.
In comparison, filename:split/1 will traverse the input string
twice (once to flatten, once to split) and filename:join/1 once.
For background on why this optimization is worthwhile, here is the
result of profiling the start-up of the run-time system on my computer
(done before this optimization):
$ $ERL_TOP/bin/erl -profile_boot
.
.
.
filename:join1/4 - 13573 : 13805 us
erlang:finish_loading/1 - 27 : 19963 us
filename:do_flatten/2 - 29337 : 49518 us
erlang:prepare_loading/2 - 49 : 52270 us
Note that filename:do_flatten/2 ends up in second place, almost
as expensive as erlang:prepare_loading/2. Your mileage may vary,
depending on the length of $ERL_TOP and the number of extra
directories added to the path using $ERL_LIBS.
Diffstat (limited to 'lib/crypto')
0 files changed, 0 insertions, 0 deletions