Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
jit-reason.html47 linesDownload Raw Back to html
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>32.1. What Is JIT compilation?</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="jit.html" title="Chapter 32. Just-in-Time Compilation (JIT)" /><link rel="next" href="jit-decision.html" title="32.2. When to JIT?" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">32.1. What Is <acronym class="acronym">JIT</acronym> compilation?</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="jit.html" title="Chapter 32. Just-in-Time Compilation (JIT)">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="jit.html" title="Chapter 32. Just-in-Time Compilation (JIT)">Up</a></td><th width="60%" align="center">Chapter 32. Just-in-Time Compilation (<acronym class="acronym">JIT</acronym>)</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="jit-decision.html" title="32.2. When to JIT?">Next</a></td></tr></table><hr /></div><div class="sect1" id="JIT-REASON"><div class="titlepage"><div><div><h2 class="title" style="clear: both">32.1. What Is <acronym class="acronym">JIT</acronym> compilation? <a href="#JIT-REASON" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="jit-reason.html#JIT-ACCELERATED-OPERATIONS">32.1.1. <acronym class="acronym">JIT</acronym> Accelerated Operations</a></span></dt><dt><span class="sect2"><a href="jit-reason.html#JIT-INLINING">32.1.2. Inlining</a></span></dt><dt><span class="sect2"><a href="jit-reason.html#JIT-OPTIMIZATION">32.1.3. Optimization</a></span></dt></dl></div><p>3   Just-in-Time (<acronym class="acronym">JIT</acronym>) compilation is the process of turning4   some form of interpreted program evaluation into a native program, and5   doing so at run time.6   For example, instead of using general-purpose code that can evaluate7   arbitrary SQL expressions to evaluate a particular SQL predicate8   like <code class="literal">WHERE a.col = 3</code>, it is possible to generate a9   function that is specific to that expression and can be natively executed10   by the CPU, yielding a speedup.11  </p><p>12   <span class="productname">PostgreSQL</span> has builtin support to perform13   <acronym class="acronym">JIT</acronym> compilation using <a class="ulink" href="https://llvm.org/" target="_top"><span class="productname">LLVM</span></a> when14   <span class="productname">PostgreSQL</span> is built with15   <a class="link" href="install-make.html#CONFIGURE-WITH-LLVM"><code class="literal">--with-llvm</code></a>.16  </p><p>17   See <code class="filename">src/backend/jit/README</code> for further details.18  </p><div class="sect2" id="JIT-ACCELERATED-OPERATIONS"><div class="titlepage"><div><div><h3 class="title">32.1.1. <acronym class="acronym">JIT</acronym> Accelerated Operations <a href="#JIT-ACCELERATED-OPERATIONS" class="id_link">#</a></h3></div></div></div><p>19    Currently <span class="productname">PostgreSQL</span>'s <acronym class="acronym">JIT</acronym>20    implementation has support for accelerating expression evaluation and21    tuple deforming.  Several other operations could be accelerated in the22    future.23   </p><p>24    Expression evaluation is used to evaluate <code class="literal">WHERE</code>25    clauses, target lists, aggregates and projections. It can be accelerated26    by generating code specific to each case.27   </p><p>28    Tuple deforming is the process of transforming an on-disk tuple (see <a class="xref" href="storage-page-layout.html#STORAGE-TUPLE-LAYOUT" title="73.6.1. Table Row Layout">Section 73.6.1</a>) into its in-memory representation.29    It can be accelerated by creating a function specific to the table layout30    and the number of columns to be extracted.31   </p></div><div class="sect2" id="JIT-INLINING"><div class="titlepage"><div><div><h3 class="title">32.1.2. Inlining <a href="#JIT-INLINING" class="id_link">#</a></h3></div></div></div><p>32    <span class="productname">PostgreSQL</span> is very extensible and allows new33    data types, functions, operators and other database objects to be defined;34    see <a class="xref" href="extend.html" title="Chapter 38. Extending SQL">Chapter 38</a>. In fact the built-in objects are implemented35    using nearly the same mechanisms.  This extensibility implies some36    overhead, for example due to function calls (see <a class="xref" href="xfunc.html" title="38.3. User-Defined Functions">Section 38.3</a>).37    To reduce that overhead, <acronym class="acronym">JIT</acronym> compilation can inline the38    bodies of small functions into the expressions using them. That allows a39    significant percentage of the overhead to be optimized away.40   </p></div><div class="sect2" id="JIT-OPTIMIZATION"><div class="titlepage"><div><div><h3 class="title">32.1.3. Optimization <a href="#JIT-OPTIMIZATION" class="id_link">#</a></h3></div></div></div><p>41    <span class="productname">LLVM</span> has support for optimizing generated42    code. Some of the optimizations are cheap enough to be performed whenever43    <acronym class="acronym">JIT</acronym> is used, while others are only beneficial for44    longer-running queries.45    See <a class="ulink" href="https://llvm.org/docs/Passes.html#transform-passes" target="_top">https://llvm.org/docs/Passes.html#transform-passes</a> for46    more details about optimizations.47   </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="jit.html" title="Chapter 32. Just-in-Time Compilation (JIT)">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="jit.html" title="Chapter 32. Just-in-Time Compilation (JIT)">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="jit-decision.html" title="32.2. When to JIT?">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 32. Just-in-Time Compilation (<acronym class="acronym">JIT</acronym>) </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 32.2. When to <acronym class="acronym">JIT</acronym>?</td></tr></table></div></body></html>
codekingpro/portable-devtools · Team Ai