diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-07-31 11:51:18 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-07-31 11:51:18 -0700 |
commit | a8bb0462097bd83cd87bf9048b8be879cff3cd6c (patch) | |
tree | 9672bb518d697f565e6e6f5861da74a94863d094 /lib/gallery.dialog.js | |
parent | 7b8ed1079624eefae8d83fac89caa0eaa3fc9ef4 (diff) |
Use readfile() instead of fopen()/fpassthru()/fclose() for brevity.
I've done some tests on a 60M flv and found that there's no difference
in memory consumption with these three approaches:
public function test() {
Kohana::close_buffers(false);
$file = "/home/bharat/basketball.flv";
if ($fd = fopen($file, "rb")) {
while (true) {
$bits = fread($fd, 65535);
if (strlen($bits) == 0) {
break;
}
print $bits;
set_time_limit(30);
}
fclose($fd);
}
Kohana_Log::add("error","test: " . print_r(array(memory_get_peak_usage(true),memory_get_peak_usage(false)),1));
}
public function test2() {
Kohana::close_buffers(false);
$file = "/home/bharat/basketball.flv";
$fd = fopen($file, "rb");
fpassthru($fd);
fclose($fd);
Kohana_Log::add("error","test2: " . print_r(array(memory_get_peak_usage(true),memory_get_peak_usage(false)),1));
}
public function test3() {
Kohana::close_buffers(false);
$file = "/home/bharat/basketball.flv";
readfile($file);
Kohana_Log::add("error","test3: " . print_r(array(memory_get_peak_usage(true),memory_get_peak_usage(false)),1));
}
Diffstat (limited to 'lib/gallery.dialog.js')
0 files changed, 0 insertions, 0 deletions