Optimize websites by removing code comments?


I wonder if there is any (noticeable) performance improvement when removing code comments from .php, .js, .css, .html, and similar files?


Mostly not, modern CPU's are very fast... The most notable improvement is the speed in the download speeds. Strip out any unnecessary comments sent down the wire to the browser, minify CSS, JavaScript files, use CDN's etc.


It depends how many comments there are.

In general though, most developers have a live version of all their code that is compressed- no whitespace outside of text formatting, no comments, etc. And an offline version that is developer-friendly with all the extra formatting and so on.

Another thing to note is with '//' style comments, they won't really hinder performance since the parser skips straight to the next line. With /**/ comments, the parsers has to keep reading all your comments until it encounters the closing */ so its <em>ever-so-slightly</em> more cpu intensive.

Paragraph 2 though, imo. :)


  • I can't install any package related to PHP with yum
  • Communicating between IFRAME and an entity
  • Can someone decipher whether timeGetTime() or QueryPerformanceCounter/QueryPerformanceFrequency has
  • WooCommerce Subscriptions - Get product of a specific subscription
  • why converting list into set in Cython takes so much time?
  • Python - decimal to integer low byte then high byte
  • StringBuilder vs ampersand equals concatentation
  • PBXCp error no such file or directory
  • android Low memory:no more background process ?? Need help
  • Why String.ToString()? [duplicate]
  • Why do I link my jquery inside a document.write?
  • How do I get KendoUI Validator to ignore hidden form elements?
  • How to negative match regex in JavaScript string replace? [duplicate]
  • Grails 3 - How to publish to Artifactory
  • Efficiently reading a csv file with windows newline on linux in Python
  • Grunt module(s) to upload all static assets to S3 / CloudFront, replace paths, and invalidate old as
  • Unity 5.1 Animator Controller not transitioning
  • How to get file download speed (transfer rate) with php?
  • How do you keep a running instance for Google App Engine
  • Is there a way to call library thread-local init/cleanup on thread creation/destruction?
  • How to apply a custom handlers to only specific folder
  • Android: How to correctly use NotifyDataSetChanged with SimpleExpandableListAdapter?
  • Check all values in string[] for length?
  • saving file generated by TCPDF
  • OOP Javascript - Is “get property” method necessary?
  • Marklogic : Query response time is very high
  • Is there a way to do normal logging with EureakLog?
  • Content-Length header not returned from Pylons response
  • Python urlparse: small issue
  • Asynchronous UI Testing in Xcode With Swift
  • Illegal mix of collations for operation for date/time comparison
  • HTML download movie download link
  • Menu Color Fade on Hover with Jquery
  • Updating server-side rendering client-side
  • Can I make an Android app that runs a web view in Chrome 39?
  • Large data - storage and query
  • How to set the response of a form post action to a iframe source?
  • How do you join a server to an Active Directory (domain)?
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • How can I remove ASP.NET Designer.cs files?