1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00
Commit Graph

20336 Commits

Author SHA1 Message Date
drh
e45771a540 Performance improvement and size reduction in the vdbeRecordCompareInt()
routine.

FossilOrigin-Name: 15f719dde4bd84d02c40301d6639bec9482f5475f3f5c2dee48910c710730363
2026-08-10 20:17:00 +00:00
drh
9163bd79c2 Performance improvement and size reduction in the OP_MakeRecord opcode.
FossilOrigin-Name: 8b1f4923748cdcd6dc2ced81805c844e7d0ba84354f8c0c3bb79a0fec2137493
2026-08-10 20:05:36 +00:00
drh
cfbb9e99c5 Add an assert() to demonstrate that an arithmetic right-shift is being
used where it is needed.

FossilOrigin-Name: cce760dc6b3a9162a4afbf9b2b8cefb872092be8616c43b60754794b592fe782
2026-08-10 19:38:44 +00:00
drh
205e512915 Fix the logic for big-endian CPUs. Add comments on how to test various
limbs of the logic.

FossilOrigin-Name: cf49f4fc96d7493745e6611069598a14200ee062d6f25f94d275d18a782cd374
2026-08-10 18:07:34 +00:00
drh
a458960c18 Fix the logic to prevent buffer overruns.
FossilOrigin-Name: 82a8332ed905c47ea99b1d567fae7607018d657d6912e3546d9d67032f9eb0ab
2026-08-10 16:27:10 +00:00
dan
24ad808809 When comparing row values that are sub-selects, do not consider the collation sequences of the expressions returned by the sub-select when determining the collation sequences to use for the comparisons. i.e. in "(a, b)=(SELECT c, d)", do not consider the collation sequences of "c" or "d". Fix for problem [forum:/info/2026-08-09T09:33:49Z | 2026-08-09T09:33:49Z].
FossilOrigin-Name: 88580851be734d1917809a4254f2f117df58c71b4c118509ccb4756a300fa6e6
2026-08-10 15:57:42 +00:00
drh
15b79d7af8 Experimental changes to improve performance of the OP_MakeRecord opcode,
and especially the code the writes integer content into the record.
This change is not yet 100% correct.  It is a work in progress.  Parking
on a branch because I need to stop and work on other things.

FossilOrigin-Name: fa8dd2af6da66d14e6e2dbf68692d02322f750198fdf97be0b72f04e0a4ca79b
2026-08-10 15:36:31 +00:00
drh
2e9b3cf33a Make this optimization available to MSVC in addition to GCC.
FossilOrigin-Name: 648ab3f7aec532689cefd13d37889e262804e2f74b0c276ac4e41647cf08dcdc
2026-08-10 12:56:41 +00:00
drh
662efd15c5 Merge the sqlite3Get8byte() enhancement from trunk
FossilOrigin-Name: 661d0c7104cc58c9b74fbf00b51ce6859e7640d0aa7f0b715b43a2d4fa4c8718
2026-08-10 12:41:48 +00:00
drh
c9771b7018 Replace the EIGHT_BYTE_U64 macro with the in-line function sqlite3Get8byte()
which is more efficient cross-platform.

FossilOrigin-Name: 9492183f2f954d89be698e0d48123d50a6dc96c06b18482e1f06ae9031506033
2026-08-10 12:29:43 +00:00
jeffchen
3a666ca2c3 Decode fixed-width integer serial types in vdbeRecordCompareInt() with a single eight-byte read and an arithmetic shift, replacing a switch that predicts poorly on mixed-width integer keys.
FossilOrigin-Name: fad1a762e1191b2869926ce27ea8185b9efd40bdf26a26383aaba7c4d490323c
2026-08-09 19:03:50 +00:00
dan
ab5206d096 Remove unused variable from pragma.c.
FossilOrigin-Name: 7e3ad0dcde0fcfae8a6e7e16af5844cd02fe16fef5927891a11166c1f54eb45a
2026-08-08 20:29:57 +00:00
drh
e0725b0a4f Improve the performance of the OP_Column opcode of the bytecode engine
by in-lining the call to sqlite3VdbeSerialGet().

FossilOrigin-Name: d2dd7b3b1355b245cc5e69dff10ad23de3b280571ab3c1cd29d4446404b31402
2026-08-08 09:58:25 +00:00
drh
e9f4537eaa Fix a comment typo. Remove an unused function prototype.
FossilOrigin-Name: b08d213dafe2ec284fccabeff0350fecdffcdd762841b381a1bcd7e02b1fda77
2026-08-07 19:11:36 +00:00
drh
c1f4848a46 Fix a harmless UBSAN warning.
FossilOrigin-Name: eb492208fceb9ea0e68ba0012806fe36f55f0b270af6f3704c51235bcae27869
2026-08-07 18:41:59 +00:00
drh
c3356c59a7 Change the order of two operations in the REAL decoded in OP_Column for a
small performance boost.

FossilOrigin-Name: d3ab3da0246df5cff298309c7d6ffbb18f1217e248bce819911db50e670eb093
2026-08-07 18:18:31 +00:00
drh
d3b165a85e Code simplifications. This check-in actually gives up a few CPU cycles
relative to the previous, according to speedtest.tcl, but not many.  And
in exchange, the binary is smaller.  The branch has a whole is still much 
faster than trunk.

FossilOrigin-Name: 20f50ea9c617307262b7b8a9b878e3fc0d18729452d7e1efd7c06625559d8afb
2026-08-07 15:09:28 +00:00
drh
da42eb7d05 Further optimization to OP_Column along the lines of the prior check-in.
FossilOrigin-Name: a4b3021d1fc465e162cf648d88b3d0900b7f206bed12d5a9b07bfffd7fc29e49
2026-08-07 11:14:34 +00:00
jeffchen
fec25f94b6 Performance optimization in OP_Column: decode serial types 0 through 6, 8, and 9 (NULL and all integer widths) inline in a switch, avoiding the call and dispatch overhead of sqlite3VdbeSerialGet(). The wide-integer cases 5 and 6 add bulk, but omitting them would leave those types paying the switch miss plus the original call. Other serial types are decoded as before.
FossilOrigin-Name: cf829cc21ba3e00e9201f02a8feb2fe60f937315f1b267457717e8cd824f8e1d
2026-08-07 00:00:05 +00:00
drh
111fa8c62e Fix a compiler warning that comes up in gcc 4.0.1 for target powerpc-apple-darwin9
FossilOrigin-Name: 90fe33d9edfd5100c4459940ee39f268da8edcdaa9315d2610428d5d1f99938d
2026-08-05 15:30:43 +00:00
jeffchen
da6fd9a046 Avoid an integer divide on the page-cache lookup fast path. The hash
table size in pcache1 is always a power of two, so the bucket index in
pcache1FetchNoMutex() can be computed with a mask instead of a modulo.
An assert() verifies the power-of-two invariant in debug builds.

FossilOrigin-Name: 750c37d4044c0957b81a12448293c0f85bab0b9f981d8e6f573ffe27eeb8f16d
2026-08-05 13:29:06 +00:00
drh
0a5f27711f The sorter enhancement at [bdc841de10fef65b] contains a bug where it
might sort 64-bit integers in the wrong order due to the limited
precision of double.  Fixed here.

FossilOrigin-Name: 6bdfff7ddb63d0b4f28f6c174a36e81486a652056a4e21644378a22feda780fd
2026-08-04 20:40:10 +00:00
drh
eb72953f00 Improved performance in the sorter by adding a special case comparison
function for when the sorting by floating-point numbers.

FossilOrigin-Name: bdc841de10fef65b627deb8b770702c976174a66af847c96ebecf24d91798744
2026-08-04 14:55:51 +00:00
drh
063b370cc5 Improved comparison function for the sorter, using the idea demonstrated
by the patch in [bugs:/info/2026-08-02T13:41:35Z|Bug 2026-08-02T13:41:35Z].

FossilOrigin-Name: 6cda98ee3c8fcd996fd8986269e0a046f41fc9cee19345e32c055435e1874c67
2026-08-03 19:59:43 +00:00
dan
0fae7568b2 When processing a vector IN(...) term in a WHERE clause, do not add individual terms for each column if the RHS of the IN(...) is a query that is expected to do the special min-max aggregate behaviour. Possible fix for [bugs:/info/2026-08-03T09:05:06Z | 2026-08-03T09:05:06Z].
FossilOrigin-Name: b5cee626e149c2cd977ad682ca34ccafe847a468f9e01b365a1fd901a08176e4
2026-08-03 14:10:21 +00:00
drh
c2f474e1dc Set O_BINARY for Windows console output in the CLI. Candidate fix for
[bugs:/info/2026-08-03T08:52:42Z|bug 2026-08-03T08:52:42Z].

FossilOrigin-Name: af136dc1d10361e41fa3bd0d31e9b066e34b19bfd2be1076cc7d7ff2bcef337a
2026-08-03 13:22:37 +00:00
drh
1b087395d7 Fix harmless compiler warnings caused by the enhancement at [a67bff640c9e4ffd]
FossilOrigin-Name: e0ab12ec7270046010c0b96682799d5659c10e6ba9620bb4bffc8209ad1272fe
2026-08-02 22:51:45 +00:00
drh
e12c6f2590 Updates to build instructions, especially on Windows. Fix a harmless
compiler working in debug builds on Windows.

FossilOrigin-Name: be245e136a550faa7c84694156c40dc9778f50b00016892c29a2314bef14b6b7
2026-08-01 15:08:48 +00:00
drh
8782e0b5be Improve comments. Move a variable outside of a loop.
FossilOrigin-Name: f26831158e28a46805466da71b3fc04e19c2199545cc8c5d68281867f8110ef3
2026-07-29 21:09:37 +00:00
dan
817458fe70 Avoid assuming that cursor numbers were allocated in order for all SrcList objects when detecting ON clauses that refer to tables to their right. Possible fix for [bugs:/info/2026-07-29T17:50:40Z | 2026-07-29T17:50:40Z].
FossilOrigin-Name: ebfea8cfb03e0578364bb1f5f8f44c55127f2155d9a0999865a811098f69e9f4
2026-07-29 19:17:40 +00:00
dan
7932ea0f9a Always take a copy of a value used to drive an index as part of a RIGHT JOIN loop. Otherwise, the RIGHT JOIN loop and the body of the loop it jumps back into may interfere with each other. Possible fix for [bugs:/info/2026-07-29T05:33:50Z | 2026-07-29T05:33:50Z].
FossilOrigin-Name: d7ad2d0a91b7b837b09b04f78e617fe80eb5ae48f178446c942c2a84e0e0201a
2026-07-29 15:49:38 +00:00
dan
3bc026df6e Avoid apply an affinity to a register that might be the result of a TK_AGG_COLUMN expression, as it might be reused. Fix for bug [bugs:/info/2026-07-29T05:51:06Z | 2026-07-29T05:51:06Z].
FossilOrigin-Name: b9ecd9caf755dd33f1de952ac8e5e2d731c20880a0872f10494f92ecf8cae331
2026-07-29 15:13:41 +00:00
dan
98c319e259 Avoid apply an affinity to a register that might be the result of a TK_AGG_COLUMN expression, as it might be reused. Possible fix for bug [bugs:/info/2026-07-29T05:51:06Z | 2026-07-29T05:51:06Z].
FossilOrigin-Name: e5cce8a0026e71985f3afd07aba4b3f550871a1079d18234efa19438eed15d2d
2026-07-29 14:23:30 +00:00
drh
37275bc277 Block deep recursion in test extension functions test_eval() and eval().
Does not affect deliverable code.
[bugs:/info/2026-07-29T06:29:11Z|Bug 2026-07-29T06:29:11Z]

FossilOrigin-Name: 3e99c27fe3db76a146bb4a77c08007e6c4598cda7975dd40d4f7f14c3bd914b5
2026-07-29 13:00:37 +00:00
dan
5a9c01b01a Further fixes for running [make devtest] with Fil-C.
FossilOrigin-Name: 1ed5e5bed26e3d38dd09541ce73dc68188574e236ecb60142260a0c40bf8902a
2026-07-28 14:16:52 +00:00
drh
43306f881e The MREMAP_FIXED macro (added by [4d60798b20a560be]) is not available
on all platforms.

FossilOrigin-Name: 8afa7a1d40eef6fd5e9d6a2c250822de607cb211b301547a3317bdb9e942c937
2026-07-27 11:19:44 +00:00
drh
35db2d60d3 Use snprintf() rather than sprintf() in the dtostr() test function of
the CLI. [forum:/info/2026-07-27T09:44:11Z|Forum 2026-07-27T09:44:11Z].

FossilOrigin-Name: c0681a6cb72c3bf012a253206ba4ef30db039cdfb01d53758cdb184b67ff954f
2026-07-27 10:19:50 +00:00
drh
701092f4a5 Improved optimization of "expr OR TRUE" and "expr OR FALSE".
[bugs:/info/2026-07-25T08:36:25Z|Bug 2026-07-25T08:36:25Z].

FossilOrigin-Name: 2f0bde4bc89c2b088c8f821719d7e457d9129c0493032152b8f4472673973e58
2026-07-25 18:56:31 +00:00
dan
536ec8a991 Avoid opening cursors only required for reads that are optimized away by the exists-to-join optimization. Addresses report [bugs:/info/2026-07-25T08:39:23Z | 2026-07-25T08:39:23Z].
FossilOrigin-Name: c81ec73a3780cf7a44965f1763f1e6e2c324b60132197756fdb351e98052fd02
2026-07-25 17:13:30 +00:00
dan
c571cec033 Ignore any DISTINCT qualifier on a SELECT statement on the RHS of an IN(...) expression. Forum post [bugs:/info/2026-07-25T08:40:13Z | 2026-07-25T08:40:13Z].
FossilOrigin-Name: c54858eab45f71a77249c8ecdc8e107cf631e743b8b883f2b6db60e0bf7e908a
2026-07-25 14:49:40 +00:00
drh
5694c3bb2a Fix a bug in the check-in [bbd69ce274620008] causing that bug-fix
check-in to fail to completely fix the original bug.  This fix is in response
to the follow-up report at
[bugs:/info/2026-07-24T02:52:08Z|Bug 2026-07-24T02:52:08Z].

FossilOrigin-Name: 2cb22877683680c1f89bcc9edb47bd1a4a8755d4a6b846a1a20136a657dacdcc
2026-07-24 14:53:59 +00:00
dan
b047809309 Fix a problem in test1.c causing test script win32lock.test to fail.
FossilOrigin-Name: 8f6d25b3f0171a40be8a5cb646739f54e496aaf9d4829c24c243ec4b71e0caa8
2026-07-24 14:10:00 +00:00
drh
2273627228 Fix to the interaction between indexes-on-expressions, subtypes, and
the unary "+" operator.  This is a continuation of the prior fix from
check-in [d75c08c8416bde3f].  This enhanced fix is prompted by
[bugs:/info/2026-07-24T08:42:47Z|Bug 2026-07-24T08:42:47Z].

FossilOrigin-Name: 5398c6a2b6b218461ce1f6437791c62c1ee125fba195660e0d6d1ad97ed6d14c
2026-07-24 13:36:44 +00:00
dan
5f5fb71834 In test_syscall.c, assume SQLite always calls the 4 (not 5) argument form of mremap(). This fixes a problem with Fil-C and mmap2.test.
FossilOrigin-Name: 4d60798b20a560beb945afe7e2998714aa7e5a83a9db078d4431040f0b6e7350
2026-07-24 10:38:27 +00:00
drh
1f2f8741b7 Fix some test cases on Windows.
FossilOrigin-Name: d2d6363f31ecbae353a1e80810f42d9e2f0f8db0fe6294c7deadf0c58669b9d0
2026-07-24 00:39:41 +00:00
drh
1a2ed04399 Enhance Bloom-filter support so that it works with blob values and with
text values as long as the collating sequence is binary.

FossilOrigin-Name: a67bff640c9e4ffdf2f48c049eaf829b9e43d167a1055bf8780ff29c910bbade
2026-07-23 21:34:16 +00:00
dan
6f9ef2245e Change the way pointers are passed between C code and Tcl test scripts. This allows tests to be run with Fil-C builds.
FossilOrigin-Name: ba919ea1d4fe84526a4c844b3f901e5e8b1650dcdee647e4d46da2d33ced1710
2026-07-23 20:04:20 +00:00
drh
b4ca411eb6 Improved Bloom-filter invariant checking.
FossilOrigin-Name: f38f4167110df11ba54816932126f695dc6e114d4001d0261669807a55ad7966
2026-07-23 18:55:12 +00:00
drh
bc9d2a9515 Fix the new filterHash() function so that it works correctly for zeroblobs.
FossilOrigin-Name: 3013d6ab4afd4f63fa63a773778adcf07821cfcb33e3ae42752aea13fd2b6224
2026-07-23 17:41:10 +00:00
drh
83f39c1788 Add the ability for Bloom filters to work on text values, as long as
the collating sequence is BINARY.

FossilOrigin-Name: 2577edc796505a0a6dabccbcc1bb6a828457092caa4d074561da5e58a6f065a2
2026-07-23 16:00:10 +00:00