Raw values of the benchmark are in a CSV file below the chart. The benchmark was done on an isolated VM, via PHP cli, with OPCache enabled. In the article, it also says 1 million iterations of throwing an exception over and over, took 0.5 seconds, and that includes function call overhead.
I'm sorry if the article read misleading. I tried my best to convey that exceptions do indeed add an overhead, but it is not something you should have to remotely worry about.
If I don't, why should I care about the article at whole? No offense meant, just I want to understand the logic: why would you write an article about something I shouldn't worry about?
Because it's sometimes taken as throwing exceptions can be expensive (https://stackoverflow.com/a/104546). This answer is 12 years old, and was written when we didn't have Throwable or as many as exceptions as we'd see in PHP 8.
Also, no offense taken and I am grateful for your constructive comments in this post and previous posts.
Raw values of the benchmark are in a CSV file below the chart. The benchmark was done on an isolated VM, via PHP cli, with OPCache enabled. In the article, it also says 1 million iterations of throwing an exception over and over, took 0.5 seconds, and that includes function call overhead.
For an article like this, all the important information is basically hidden. I only barely noticed the link to the CSV file. That data should be right up front and centre. The fact that it really doesn't matter is again just slid in there instead of being up front and centre.
Instead, we have a graph that if you just scan the code makes it look like there is a performance issue. A graph that doesn't have any scales. You then talk about how the performance is 3x better before casually saying it won't make any difference. Instead of showing it wouldn't. Someone says you did a good job highlighting something, but that something isn't even highlighted in your post, so seems kinda wrong.
View all comments
Show parent comment
3
u/ayeshrajans Sep 09 '20
Hi there, author of the article here.
Raw values of the benchmark are in a CSV file below the chart. The benchmark was done on an isolated VM, via PHP cli, with OPCache enabled. In the article, it also says 1 million iterations of throwing an exception over and over, took 0.5 seconds, and that includes function call overhead.
I'm sorry if the article read misleading. I tried my best to convey that exceptions do indeed add an overhead, but it is not something you should have to remotely worry about.