> I think you're also greatly over-estimating how large the startup cost is in 
> practice.  It's real, certainly, but unless you have several nested 
> microservices a well-made framework should have a fairly small overhead.

I want to share my experience that some users have very slow file I/O,
and I regularly see `file_exists` and `stat` show up in slow code
paths. This is one reason I would like to remove the warning on a
failed `include`, because then instead of `if (file_exists($file))
require $file;` or similar, you can just `include $file;` it. When I
brought it up last time, some people actually liked that it has
warnings so... I didn't move forward. Maybe there's room for
`try_include`:

[$included, $retval) = try_include($file);
if ($included) {
    // $retval will have the return value of the file
} else {
    // $retval will have a warning/error message you can work with
}

I like this quite a bit less than changing `include` to not emit a
warning, but it's not without merits:
 1. `include` still emits a warning, so nobody relying on that will be
surprised.
 2. User gets to control error handling.
 3. Can be polyfilled, it just costs a bit of performance.

Anyway, it's a bit off topic, so I'll stop here.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to