3 ms·
Why was there a NOOP in the table creation byte code? And do other database engines take this approach?
by IgorPartola 5y ago
Why was there a NOOP in the table creation byte code? And do other database engines take this approach?
- woodruffw 5y ago> And do other database engines take this approach? It's not exactly the same, but Postgres includes an LLVM-based JIT that compiles queries for reuse[1]. [1]: https://www.postgresql.org/docs/current/jit-reason.html https://www.postgresql.org/docs/current/jit-reason.html
- tyingq 5y ago>Why was there a NOOP in the table creation byte code? I don't see the NOOP in the article, but you do see these in sqlite when they, for example, have a struct of opcodes do dual duty for something like open-for-reading and open-for writing, where the struct has this: /* One of the following two instructions is replaced by an OP_Noop. */ {OP_OpenRead, 0, 0, 0}, /* 3: Open cursor 0 for reading */ {OP_OpenWrite, 0, 0, 0}, /* 4: Open cursor 0 for read/write */
- IgorPartola 5y ago> 13. Close 0 0 0 — Close the cursor we opened previously (cursor 0). > > 14. Close 0 0 0 — No-op, since the cursor is already closed
- jhgb 5y agoI guess that depends on what exactly you mean by "this approach"? In case you mean running queries in a VM, Firebird/Interbase has had it since the 1980s (in form of the Binary Language Representation, or BLR).
- dspillett 5y agoNot sure it'll make any difference to the VM sqlite uses, but when compiling for real processors NOOPs are sometimes added where word alignment or lack thereof can have performance impacts on subsequent instructions, either when running them or for instructions elsewhere that jump to them.