DEV Community

loading...
Cover image for Windows Server S*ck

Windows Server S*ck

Jorge Castro
You are free to believe in whatever you want to, me too. So, stop preaching your religion, politics, or belief. Do you have facts? Then I will listen. Do you have a personal belief? Sorry but no.
・1 min read

I get an issue in my Github, something about the optimization of a procedure and how it accesses the database.

In PHP, apparently, the method file_exists() (it finds if a file exists) is slower than the method is_file() (it returns true if a path is a file), so I decided to do a benchmark:

100k interactions, smaller is better

Windows Server:

file_exists is_file
3.451578140258789 (sec) 2.0834150314331055 (sec)

And yes, is_file() is faster.

And I did the same in my Linux box and it is the result:

file_exists is_file
0.1745491027832 0.062805891036987

https://memegenerator.net/img/images/400x/17391904.jpg

It is not a small difference but a big difference. Linux is around 20x faster than Windows accessing the files.

So Windows Server is not only slower but also it is expensive.

Discussion (0)