1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Small performance increase in jsonTranslateBlobToText().

FossilOrigin-Name: 3b1dcac2eeaf5f97450919f2a6eed74a4d54fb2b812bdb4a580f79d075e99dfe
This commit is contained in:
drh
2025-02-10 00:20:50 +00:00
parent 3efac4aa78
commit 93df8109fc
3 changed files with 13 additions and 10 deletions

View File

@ -2199,9 +2199,12 @@ static u32 jsonTranslateBlobToText(
}
case JSONB_TEXT:
case JSONB_TEXTJ: {
jsonAppendChar(pOut, '"');
jsonAppendRaw(pOut, (const char*)&pParse->aBlob[i+n], sz);
jsonAppendChar(pOut, '"');
if( pOut->nUsed+sz+2<=pOut->nAlloc || jsonStringGrow(pOut, sz+2)==0 ){
pOut->zBuf[pOut->nUsed] = '"';
memcpy(pOut->zBuf+pOut->nUsed+1,(const char*)&pParse->aBlob[i+n],sz);
pOut->zBuf[pOut->nUsed+sz+1] = '"';
pOut->nUsed += sz+2;
}
break;
}
case JSONB_TEXT5: {