View Single Post
  #8  
Old 31st March 2021, 01:03
darkalchemy darkalchemy is offline
Administrator
 
Join Date: Dec 2017
United States
Posts: 101
Default
@Elena

It's your code and you can write it any way you like. I am not posting to criticize your choice. I would just like to provide a little information. You can take it or leave it.

Minification and compression are great for artifacts(css, js, html) that the browser downloads. The browser does not download php code. The server has to open the file, read it and compile into opcode.

Since you are not compressing the file, only removing whitespace, there is no performance loss to decompress it.

When php reads a file, all comments and white space are entirely ignored by the interpreter, so there is no benefit whatsoever to removing all of the whitespace. The only thing you are adding to it by doing so is making it nearly impossible for anyone else to read your code.

I have forked your repo, added php-cs-fixer and it fails on 12 files. If you would like, I can edit your code so that it is more easily readable and update for php 7.3 which if you're doing all this for speed, is the greatest speed improvement you can do. I may do this anyway and post it to my fork.

Here is a link to a phoronix benchmark showing in all cases a 200%-500% increase in performance and reduction in processing time.

This is just my 2 cents and you don't have to agree or even listen, but I appreciate you taking the time to read it.
Reply With Quote