Req #73433 [Com]: could posix_fadvice be added?
| From: | vikesgvogdg at gmail dot com | Date: | Mon, 10 Apr 2023 05:59:36 +0000 |
| Subject: | Req #73433 [Com]: could posix_fadvice be added? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-244162@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73433&edit=1
ID: 73433
Comment by: vikesgvogdg at gmail dot com
Reported by: divinity76 at gmail dot com
Summary: could posix_fadvice be added?
Status: Assigned
Type: Feature/Change Request
Package: POSIX related
Operating System: unix*
PHP Version: Next Minor Version
Assigned To: pollita
Block user comment: N
Private report: N
New Comment:
EzeeBooks comprehensive CRM for sales and customer management, HR & Payrolls, Project,
Reporting and Analytics, and much more. More info: (https://ezeebooks.com)github.com
Previous Comments:
------------------------------------------------------------------------
[2017-03-17 22:43:09] pollita@php.net
This sounds like a good idea.
------------------------------------------------------------------------
[2016-10-31 19:04:45] divinity76 at gmail dot com
Description:
------------
a php script doing file opretaions might benefit from posix_fadvice, could that be added?
additional note: it might be worth looking into adding posix_fadvice calls to file_put_contents /
file_get_contents , namely POSIX_FADV_SEQUENTIAL, because those always are.
Test script:
---------------
<?php
$fp=fopen('bigfile','rb');
// tell the kernel that i'm probably only going to access this data once,
// so it's probably a waste to add this to the filesystem cache
posix_fadvice($fp,0,0,POSIX_FADV_NOREUSE);
// tell the kernel that i'm probably going to read from byte 12345 to 123456789 sequentially,
so optimize for that
posix_fadvice($fp,12345,123456789,POSIX_FADV_SEQUENTIAL);
fseek($fp,12345);
$content=fread($fp,123456789-12345);
fclose($content);
// aka file_get_contents('bigfile',false,NULL,12345,123456789-12345);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73433&edit=1