LLVMJIT: introduce force-inlined functions

From: Pierre Ducroquet <p(dot)psql(at)pinaraf(dot)info>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: LLVMJIT: introduce force-inlined functions
Date: 2026-01-26 17:23:23
Message-ID: 0ZWNQh_SmV9oIbQW9PIXIfsTPKp6-7glTtLq-jntPv9orZTvG-XTTnvDkyrB86TqEWbNCmDqJU-MIZX3QbyuWtALC7mhZGPjMrCg1pxoyYk=@pinaraf.info
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

A bunch of functions are the most used in queries. The llvmjit inlining system (tries to) get rid of the overhead of calling any function, but this is triggered only when the cost is above jit_inline_above_cost. There is thus a nice performance boost to have by choosing to "manually" inline a few specific PostgreSQL functions.
In this first patch, I've chosen to inline int4eq, int8eq and most date comparison functions.
They are definitely small, the generated code is not bigger when inlining them (surprisingly, on amd64 the code is even smaller) and are unlikely to ever change so there won't be any maintenance burden here.
On my AMD 3900XT system, this gives me a 3 to 5% performance improvement when running 1M dateeq calls.
I will likely submit a second patch version later with more functions implemented, but I thought this was an interesting first result worth discussing already.

Regards

Attachment Content-Type Size
0001-llvmjit-introduce-force-inlined-functions.patch text/x-patch 7.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-01-26 17:26:26 Re: tablecmds: reject CLUSTER ON for partitioned tables earlier
Previous Message Robert Haas 2026-01-26 17:22:33 Re: pg_waldump: support decoding of WAL inside tarfile