Skip to content

[pull] master from php:master - #1221

Merged
pull[bot] merged 3 commits into
turkdevops:masterfrom
php:master
Aug 26, 2026
Merged

[pull] master from php:master#1221
pull[bot] merged 3 commits into
turkdevops:masterfrom
php:master

Conversation

@pull

@pull pull Bot commented Aug 26, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

lazerg and others added 3 commits August 26, 2026 12:33
imagebmp() writes its pixel data a byte at a time, and the gd stream
context turned each of those bytes into its own php_stream_write() call.
PHP streams do no write buffering, so a 1920x1080 truecolor image cost
about six million write syscalls. libgd's own FILE context does not show
this because stdio buffers for it.

Buffering the stream context in 8 KB chunks takes that image from 9.5s
to 0.02s here, with byte-identical output. imagewbmp(), imagegd() and
imagegd2() go through the same context and were writing per byte too, so
they get the same fix. imagexbm() goes through the same context but
writes its output via putBuf rather than per-byte putC, so it was not
affected by this bug and sees no change from this patch.

Close GH-23460
* PHP-8.4:
  Fix GH-23457: imagebmp() is extremely slow when writing to a file
* PHP-8.5:
  Fix GH-23457: imagebmp() is extremely slow when writing to a file
@pull pull Bot locked and limited conversation to collaborators Aug 26, 2026
@pull pull Bot added the ⤵️ pull label Aug 26, 2026
@pull
pull Bot merged commit a2a2029 into turkdevops:master Aug 26, 2026
1 of 3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants