On Thu, Jan 25, 2018 at 11:20:28AM -0800, Andres Freund wrote: > On 2018-01-25 18:40:53 +0300, Konstantin Knizhnik wrote: > > Another question is whether it is sensible to redundantly do > > expensive work (llvm compilation) in all backends. > > Right now we kinda have to, but I really want to get rid of that. > There's some pointers included as constants in the generated code. I > plan to work on getting rid of that requirement, but after getting > the basics in (i.e. realistically not this release). Even after > that I'm personally much more interested in caching the generated > code inside a backend, rather than across backends. Function > addresses et al being different between backends would add some > complications, can be overcome, but I'm doubtful it's immediately > worth it.
If we go with threading for this part, sharing that state may be simpler. It seems a lot of work is going into things that threading does at a much lower developer cost, but that's a different conversation. > > So before starting code generation, ExecReadyCompiledExpr can first > > build signature and check if correspondent library is already present. > > Also it will be easier to control space used by compiled libraries in > > this > > Right, I definitely think we want to do that at some point not too far > away in the future. That makes the applicability of JITing much broader. > > More advanced forms of this are that you JIT in the background for > frequently executed code (so not to incur latency the first time > somebody executes). Aand/or that you emit unoptimized code the first > time through, which is quite quick, and run the optimizer after the > query has been executed a number of times. Both sound pretty neat. Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate