Skip to content

ext/pdo_sqlite: Avoid copying bound strings and LOBs - #476

Closed
iliaal wants to merge 1 commit into
masterfrom
opt/pdo-sqlite-retain-bound-strings
Closed

iliaal wants to merge 1 commit into
masterfrom
opt/pdo-sqlite-retain-bound-strings

Conversation

@iliaal

@iliaal iliaal commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Retain the bound zend_string until SQLite releases it, as Nora suggested in php#25597. This avoids a copy each time PDO SQLite binds a text or LOB parameter.

With SQLite 3.37.2, binding and inserting 96 values of 1 MiB each into an in-memory database took 14.5% less time for text and 12.4% less for BLOBs. These are medians across 18 paired runs, excluding the transaction commit.

Retain the zend_string for each binding and let SQLite release it when
the value is no longer needed. Clear a rejected oversized binding so a
later execute that omits the parameter still sees NULL.
@iliaal

iliaal commented Nov 22, 2026

Copy link
Copy Markdown
Owner Author

Opened upstream as php#25655.

@iliaal iliaal closed this Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant