6.0.0-beta1
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
11/9/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#3359] Make use of streams for speed and memory efficiency
*
Your Email Address
*
Spam protection
Enter the letters below:
._.._.. ,. . , | | \./ | \./ _|__|_ | |___ |
Comment
> Some notes on some testing: > > > > Will want to use this format: > > php://filter/read=convert.base64-encode/resource=file:///tmp/foo > > > > See http://us.php.net/manual/en/wrappers.php.php > > > > Don't use file_get_contents()/stream_get_contents(). On my test file > (11 MB of text data), file_get_contents() required 23 MB. This is > much more efficient: > > > > while (!feof($a)) { > > $b .= fread($a, 8192); > > } > > > > This used only 300-400KB over the file size. > > > > Same with writing - don't use file_write_contents() for large data. > fwrite in chunks (4096 is probably good). > > > > And use temp stream. temp will copy to memory for first X MB > (configurable) and then will write to disk. Reading the 11 MB file > via the method above, and then writing to temp stream using fwrite(), > and then rewinding temp stream pointer and reading entire file using > fread() took only 14 MB total.
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers