Skip to:
Content
Pages
Categories
Search
Top
Bottom

Optimize by removing blank lines and comments?

  • @synaptic

    Participant

    Looking at this chart and data:
    http://www.ohloh.net/p/buddypress/analyses/latest/languages_summary

    I realized that 44% of the code that runs buddypress is either blank lines or comment lines. I do realize that these add value by making the code easier to read, edit, update and improve for humans.

    However, once installed and running, would it be better for performance to strip these out and only leave the 56% that is actually necessary to run the buddypress plugin? would it make a significant difference? Thanks

    Total Lines : 101,797
    Code Lines : 57,255
    Percent Code Lines : 56.2%

    Total Comment Lines : 27,877
    Percent Comment Lines : 27.4%

    Total Blank Lines : 16,665
    Percent Blank Lines : 16.4%

Viewing 5 replies - 1 through 5 (of 5 total)
  • @synaptic

    Participant

    umm… is this a stupid question?

    @henrywright-1

    Member

    @synaptic not a stupid question – always a good idea to improve performance. That said, removing comments isn’t where you should start.

    1. Try minifying your scripts that haven’t already been minified.
    2. Run your site through a tool such as tools.pingdom.com to identify all of the unnecessary resources your page is using – and remove them where appropriate
    3. Deactivate unused plugins and so on…

    Some more ideas:

    a) Lazy loading of images on long pages
    b) Defer loading of javascript

    So many ways to improve performance – cutting back on comments, though, isn’t a way I’d recommend.

    @synaptic

    Participant

    @henrywright-1 Thanks Henry, I’m familiar with the usual steps you outline. Just curious if removing comments and blank lines would make a significant difference 🙂

    @boonebgorges

    Keymaster

    I agree with what the folks above have said. You could probably shave a few milliseconds off of the time it takes for the PHP interpreter to compile BP into bitcode. If you’re serving billions of pageviews, this might be worthwhile. But generally, there are far more effective ways to increase performance. @henrywright-1 makes some good suggestions. Look first at the items that are being delivered to the user: images, javascript, etc. Then, look at ways to speed up the loading of WordPress by getting rid of unneeded plugins, etc (that actually *do* take appreciable time to load).

    Good luck!

    @hnla

    Participant

    and ensure you are using some form of server side compression i.e on Apache mod_deflate that will make far more difference than trying to minfy any client deliverable files, don’t mess with inline comments or human readable formatting if possible.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Optimize by removing blank lines and comments?’ is closed to new replies.
Skip to toolbar