From 4768f9eaa9633d253fbaad67a36be5ddca554dec Mon Sep 17 00:00:00 2001 From: zleyyij <75810274+zleyyij@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:43:25 -0600 Subject: [PATCH] vault backup: 2024-07-03 11:43:25 --- notes/Copy-and-Patch Compilation.md | 1 + 1 file changed, 1 insertion(+) diff --git a/notes/Copy-and-Patch Compilation.md b/notes/Copy-and-Patch Compilation.md index d835968..2e7aba1 100644 --- a/notes/Copy-and-Patch Compilation.md +++ b/notes/Copy-and-Patch Compilation.md @@ -15,6 +15,7 @@ One proposed use case of copy-and-patch compilation in the paper is as an SQL qu (Halfway through Page 3): > The compilation time of our compiler is so low that it is less than the time it takes to construct the AST of the program. Compared with interpreters, both have negligible startup delay (since constructing ASTs takes longer), but our execution performance is an order of magnitude faster. Compared with LLVM -O0, our implementation compiles two orders of magnitude faster and generates code that performs on average 14% better. Therefore, we conclude that copy-and-patch renders both interpreters and LLVM -O0 compilation obsolete in this use case. + # Implementation Details At a broad level, copy and patch code compilation works by having a pre-built library of composable binary code snippets, referred to as binary stencils. Each binary stencil performs the operation of a single AST node/bytecode instruction. This makes both code generation and optimization a simple task, achieved simply by performing a lookup in a data table to select the stencil, then copying it to the output and patching in the missing values.