diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2011-09-30 23:06:03 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2011-09-30 23:06:03 +0100 |
commit | 2f761a511aaaa58b2a49c96c5f2e78cc1f85ff71 (patch) | |
tree | e11e630edfef14b2650df05bc728b5ad8c63a407 | |
parent | 3e321b038b4bc09de8eb119df978de8990dd8980 (diff) | |
download | rabbitmq-server-2f761a511aaaa58b2a49c96c5f2e78cc1f85ff71.tar.gz |
avoid creation of intermediate binaries by using io_lists
This is worth 1-2% with "MCM -a" and two Erlang schedulers
-rw-r--r-- | src/rabbit_binary_generator.erl | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/rabbit_binary_generator.erl b/src/rabbit_binary_generator.erl index 68511a32..75d7edf4 100644 --- a/src/rabbit_binary_generator.erl +++ b/src/rabbit_binary_generator.erl @@ -122,10 +122,9 @@ build_content_frames(SizeAcc, FramesAcc, FragSizeRem, FragAcc, build_heartbeat_frame() -> create_frame(?FRAME_HEARTBEAT, 0, <<>>). -create_frame(TypeInt, ChannelInt, PayloadBin) when is_binary(PayloadBin) -> - [<<TypeInt:8, ChannelInt:16, (size(PayloadBin)):32>>, PayloadBin, <<?FRAME_END>>]; create_frame(TypeInt, ChannelInt, Payload) -> - create_frame(TypeInt, ChannelInt, list_to_binary(Payload)). + [<<TypeInt:8, ChannelInt:16, (iolist_size(Payload)):32>>, Payload, + ?FRAME_END]. %% table_field_to_binary supports the AMQP 0-8/0-9 standard types, S, %% I, D, T and F, as well as the QPid extensions b, d, f, l, s, t, x, |