aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-08-08 21:42:14 +0200
committerAnders Svensson <[email protected]>2017-08-10 11:16:00 +0200
commit90b18515763cc332a1f2e612a24c50f245b5dc72 (patch)
tree31ca768f6ea1effab3f354cbf5bf092ad62de1b4 /lib/diameter
parentd1f4369afb9fb9453ebe8868d88ae299d908a2e4 (diff)
downloadotp-90b18515763cc332a1f2e612a24c50f245b5dc72.tar.gz
otp-90b18515763cc332a1f2e612a24c50f245b5dc72.tar.bz2
otp-90b18515763cc332a1f2e612a24c50f245b5dc72.zip
Split AVPs at decode
Despite what the Efficiency Guide says about match being more efficient, split_binary appears to be slightly faster. (Although this one extraction is a drop in the bucket.) Binary optimizations aren't an issue during decode.
Diffstat (limited to 'lib/diameter')
-rw-r--r--lib/diameter/src/base/diameter_codec.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/diameter/src/base/diameter_codec.erl b/lib/diameter/src/base/diameter_codec.erl
index c171ea9dca..63e39b12d1 100644
--- a/lib/diameter/src/base/diameter_codec.erl
+++ b/lib/diameter/src/base/diameter_codec.erl
@@ -321,7 +321,7 @@ decode_avps('', _, _, _, #diameter_packet{header = H, %% unknown message
%% msg = undefined identifies this case.
decode_avps(MsgName, Mod, AppMod, Opts, #diameter_packet{bin = Bin} = Pkt) ->
- <<_:20/binary, Avps/binary>> = Bin,
+ {_, Avps} = split_binary(Bin, 20),
{Rec, As, Errors} = Mod:decode_avps(MsgName,
Avps,
Opts#{dictionary => AppMod,