1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Improve the performance of the built-in REPLACE() function in cases where

it does many substitutions that make the string larger.  OSSFuzz is reporting
intermittant timeouts when running a test where it does a REPLACE() on a 
930KB random blob. Perhaps this enhancement will fix that.

FossilOrigin-Name: fab2c2b07b5d3cd851db3e6f5c8a44155e32b0df22905ea33412b153b825a928
This commit is contained in:
drh
2018-02-09 23:25:14 +00:00
parent 510fea885e
commit f313952097
4 changed files with 45 additions and 25 deletions

View File

@ -507,6 +507,17 @@ if {$encoding=="UTF-16le"} {
execsql {SELECT hex(replace('aabcdefg','a','aaa'))}
} {616161616161626364656667}
}
do_execsql_test func-9.14 {
WITH RECURSIVE c(x) AS (
VALUES(1)
UNION ALL
SELECT x+1 FROM c WHERE x<1040
)
SELECT
count(*),
sum(length(replace(printf('abc%.*cxyz',x,'m'),'m','nnnn'))-(6+x*4))
FROM c;
} {1040 0}
# Use the "sqlite_register_test_function" TCL command which is part of
# the text fixture in order to verify correct operation of some of