From 2ca47665be7b4867e5620adddfd0abcb0908eff6 Mon Sep 17 00:00:00 2001 From: David Ansari Date: Tue, 17 Jun 2025 09:33:48 +0200 Subject: [PATCH] Avoid list allocation This is simmilar to https://github.com/rabbitmq/rabbitmq-server/pull/14056. The performance benefit is probably negligbile though since this is called only after each batch of Ra commands. Nevertheless, it's unnecessary to allocate a list with 3 elements and therefore 6 words on the heap, so let's optimise it. --- deps/rabbit/src/rabbit_fifo.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/rabbit/src/rabbit_fifo.erl b/deps/rabbit/src/rabbit_fifo.erl index d61fa46170ac..0b7ce0a8c43a 100644 --- a/deps/rabbit/src/rabbit_fifo.erl +++ b/deps/rabbit/src/rabbit_fifo.erl @@ -2806,7 +2806,7 @@ smallest_raft_index(#?STATE{messages = Messages, SmallestDlxRaIdx = rabbit_fifo_dlx:smallest_raft_index(DlxState), SmallestMsgsRaIdx = rabbit_fifo_q:get_lowest_index(Messages), SmallestRaIdx = rabbit_fifo_index:smallest(Indexes), - lists:min([SmallestDlxRaIdx, SmallestMsgsRaIdx, SmallestRaIdx]). + min(min(SmallestDlxRaIdx, SmallestMsgsRaIdx), SmallestRaIdx). make_requeue(ConsumerKey, Notify, [{MsgId, Idx, Header, Msg}], Acc) -> lists:reverse([{append,