Bug Report #2050

error_reporting(0) is slow

Added by Chris Bandy almost 5 years ago. Updated over 3 years ago.

Status:NewStart date:09/03/2009
Priority:LowDue date:
Assignee:-% Done:

0%

Category:Core
Target version:2.4.1
Resolution: Points:

benchmark.png (14.7 KB) Chris Bandy, 09/03/2009 06:50 AM

Error_Reporting_Benchmark.php Magnifier (1.27 KB) Chris Bandy, 09/03/2009 06:50 AM

Image_Error_Benchmark.php Magnifier (571 Bytes) Chris Bandy, 09/09/2009 07:11 AM

History

#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.

#2 Updated by Chris Bandy almost 5 years ago

The results for getimagesize() are actually astonishing. It may vary case by case, but when you don't need the return value of the function, error exceptions may be the best.

#3 Updated by Chris Bandy almost 5 years ago

  • File deleted (exception_benchmark.png)

#4 Updated by Chris Bandy almost 5 years ago

Totally wrong. My Codebench was non-standard.

#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.

#6 Updated by Chris Bandy over 4 years ago

  • Assignee set to Chris Bandy
  • Target version changed from 2.4 to 2.4.1

#7 Updated by Chris Bandy over 3 years ago

  • Assignee deleted (Chris Bandy)

Also available in: Atom PDF