# Performance difference between if(!-e) and try\_files?

**URL:** <https://www.ruby-forum.com/t/performance-difference-between-if-e-and-try-files/191599>\
**Category:** NGINX\
**Created:** [July 15, 2010, 4:57am UTC](https://www.ruby-forum.com/t/performance-difference-between-if-e-and-try-files/191599 "2010-07-15T04:57:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [July 15, 2010, 4:57am UTC](https://www.ruby-forum.com/t/performance-difference-between-if-e-and-try-files/191599/1 "2010-07-15T04:57:20Z")

</div>

I am trying to generate a following in getting a small modification  
added to Drupal that would allow it to work with try\_files, as it  
doesn’t right now (full explanation here:  
[nginx and Drupal | Drupal.org](http://drupal.org/node/827236))

I am wondering though, exactly how many syscalls or savings per  
request you get from using try\_files instead of if (!-e  
$request\_filename) ? It would be interesting to be able to reference  
some numbers, and I don’t trust my debugging skills to get it right.  
Igor, you probably know how many each one makes in your sleep… 🙂  
would you have any ideas?

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [July 15, 2010, 5:05am UTC](https://www.ruby-forum.com/t/performance-difference-between-if-e-and-try-files/191599/2 "2010-07-15T05:05:32Z")

</div>

FWIW, we ran with “if (!-e…)” for about 2.5 years, filling up our  
error.log files with useless messages in the operation of that scheme.  
It  
help hide a number of problems that were not see because the volume of  
messages was so high.

By using try\_files, we were able to substantially clean up our  
implementation, and find and fix a number of problems.

We have not measured performance with this change, but just the fact  
that  
you don’t make a log file entry in the error.log is probably a win in  
and of  
itself, I would think.

-peter

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [July 15, 2010, 5:16am UTC](https://www.ruby-forum.com/t/performance-difference-between-if-e-and-try-files/191599/3 "2010-07-15T05:16:39Z")

</div>

On Wed, Jul 14, 2010 at 8:04 PM, Peter Portante  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> We have not measured performance with this change, but just the fact that  
> you don’t make a log file entry in the error.log is probably a win in and of  
> itself, I would think.

I try to use it wherever possible as Igor recommends it but right now  
Drupal doesn’t cooperate. That’s why I am hoping to push this change  
forward in Drupal. I thought it would be interesting to know  
internally how much is saved. Logfile pollution / possible error  
string concatenation is a nice bonus (I know PHP’s internal error  
logging concatenates the error string and that’s why it is good to  
never have anything - even notice/info/etc. as it starts degrading  
performance on some level)
