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.
This commit is contained in:
David Ansari 2025-06-17 09:33:48 +02:00
parent 90cb5571cf
commit 2ca47665be
1 changed files with 1 additions and 1 deletions

View File

@ -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,