Bug Report #2050
error_reporting(0) is slow
In a few places we disable error reporting for just a single call. In these cases, the error suppression operator is faster than two calls to
Other uses of
error_reporting() could benefit from this speed-up, but need more testing.
Almost all of these cases need more specific comments about what errors they are ignoring.
#1 Updated by Isaiah DeRose-Wilson almost 5 years ago
Interesting, I guess I will have to get over my hate for @... nah I don't think that's possible!
Some of these could be 'fixed' with try/catch, like the source:branches/2.4/system/libraries/Image.php@4529#L84. With the new exception handler we should be able to catch the php error from getimagesize() instead of suppressing the error and than check the output.
However, for others like file::mime() I guess using @ would be the best option, as we don't want to catch the error and I'm guessing that a try/catch block is slower than just suppressing the error.
#5 Updated by Mike Parkin almost 5 years ago
These percentages are good, but without actual code execution times im not sure how useful they are...
You seem to be benchmarking something that (in my mind) must be like 0.00001% of the application if that?
Not saying there is anything wrong with you speeding something up, just that your time might be better spent optimising something with a better percentile of CPU usage.
Also I think readabilty is > micro optimisations - so i guess it is up to you to decide what is easier to read the lowering of error reporting or an error suppression.