Re: Default JIT setting in V12 - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Default JIT setting in V12
Date
Msg-id 20190904145116.5mpy7m7ab5iysusa@alap3.anarazel.de
Whole thread Raw
In response to Default JIT setting in V12  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: Default JIT setting in V12
List pgsql-hackers
Hi,

On 2019-09-04 09:56:28 -0400, Jeff Janes wrote:
> I think it is intuitive, and with empirical evidence, that we do not want
> to JIT compile at all unless we are going to optimize the compiled code.

There's pretty clear counter-evidence however as well :(

I think it's probably more sensible to use some cheap minimal
optimization for the "unoptimized" mode - because there's some
non-linear cost algorithms with full optimizations enabled.

How does your example look with something like:

diff --git i/src/backend/jit/llvm/llvmjit.c w/src/backend/jit/llvm/llvmjit.c
index 82c4afb7011..85ddae2ea2b 100644
--- i/src/backend/jit/llvm/llvmjit.c
+++ w/src/backend/jit/llvm/llvmjit.c
@@ -428,7 +428,7 @@ llvm_optimize_module(LLVMJitContext *context, LLVMModuleRef module)
     if (context->base.flags & PGJIT_OPT3)
         compile_optlevel = 3;
     else
-        compile_optlevel = 0;
+        compile_optlevel = 1;
 
     /*
      * Have to create a new pass manager builder every pass through, as the

which I think - but I'd have to check - doesn't include any of the
non-linear cost optimizations.


> Is there a rationale for, or other examples to show, that it makes sense
> for the default value of jit_optimize_above_cost to be 5 fold higher than
> the default setting of jit_above_cost?

Yes. IIRC even tpc-h or something shows that with small scale one does
get noticable - but not crazy - speedups with unoptimized code, but that
it's a loss with optimized code.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: fn ln
Date:
Subject: Re: BUG #15977: Inconsistent behavior in chained transactions
Next
From: Tom Lane
Date:
Subject: Re: Unexpected "shared memory block is still in use"