[php-src] PR #25993: ext/ftp: Improve FTP_ASCII download performance

From: Date: Tue, 01 Dec 2026 11:07:10 +0000
Subject: [php-src] PR #25993: ext/ftp: Improve FTP_ASCII download performance
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41312@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25993 Author: adapik A small refactoring of ASCII mode downloads, both blocking and non-blocking. write() syscall was called far too often (ftp_nb_get per byte, ftp_get per line). The CRLF conversion now lives in a helper shared by both paths, which converts each received chunk and writes it at once. This makes downloads much faster. 12.5 MB CRLF file, local server: | Function | ASCII before | ASCII after | Speedup | Binary (just for comparison) | |---|---|---|---|---| | ftp_get() | 0.026 GB/s | 0.63 GB/s | ~25x | 0.76 GB/s | | ftp_nb_get() | 0.0015 GB/s | 0.57 GB/s | ~380x | 0.70 GB/s | ASCII mode is probably not widely used nowadays, but it is still supported, and since the problem is fairly obvious and the fix is small, I think it's worth having. I also added a test for non-blocking, this function was only partially covered.

« previous php.git-pulls (#41312) next »