back to homepage Try w3compiler! Buy w3compiler! Specs Frequently Asked Questions Support Contact
w3compiler Frequently Asked Questions
w3compiler Basics
JavaScript Optimization
Optimization by Scripting Environment
Advanced Features
Miscellaneous Questions


How do I know that your Web site optimization tool won't break my site?
w3compiler uses very conservative and context-aware compression or code optimization. Rather than trying to squeeze every byte out of files or make guesses about input quality, we opted to modify only those statements which were well formed and in which meaning could be preserved during optimization. If you input garbage markup and script into w3compiler, the software will only optimize the code in places that are well formed and follow specifications. If you run w3compiler on well formed (X)HTML or relatively proper HTML, CSS, or JS documents, it will safely optimize the files.

Besides conservative optimization, we also heavily tested the product by downloading well known Web sites' home pages and optimizing them with w3compiler. While other white space removal-type programs occasionally optimized to a greater extent, none of the most popular applications accurately preserved what was given more than 80-90% of the time, and many worked less than half the time! After testing with hundreds of sites and thousands of publicly available scripts at sites like dynamicdrive.com, sourceforge.net, mts.net, brinkster.com, freshmeat.net, php.resourceindex.com, phpopenchat.org, k5n.us, netzministerium.de, netwindows.org, hotwired.lycos.com/webmonkey, walterzorn.com, and karlson.ru. w3compiler safely optimizes nearly any reasonably formed document!

back to top


Isn't this just glorified white space removal?
While you might say that after looking casually at its output, w3compiler does much, much more than any simple white space stripper you'll find on the market. We do a full parse of HTML, CSS, and JavaScript and calculate minimal representations wherever possible. While white space is certainly a significant factor in size reduction, w3compiler condenses markup, colors, and entities in other ways. Furthermore, in the case of JavaScript -- just like a regular programming language compiler -- we remap object, function, and variable names, as well as optimize code by removing redundant structures and condensing statements. We can even save space with file name remapping and other more advanced approaches.

back to top


How context-aware is w3compiler's code optimization?
Very. We crafted our own tests and made sure that edge cases were always addressed. For example, when optimizing server-side scripted pages such as ASP or PHP, we are sensitive to comments indicating server-side includes (SSI) statements. Another example is how w3compiler performs basic JavaScript parsing to understand what white space can be safely removed, as many compressors will break scripts with misplaced semicolons or other sloppy code. Of course, we take into account external files, CSS effects on HTML such as the white-space property, tricky uses of the eval statement in JavaScript, and all sorts of other interactions.

back to top


Do I have to optimize my whole site or just pieces of it?
It's up to the developer. When loading a project, you can optimize all or selected pieces of a site. You can also set comments or In-Page Directives for files or sections of files to be skipped. If you want to preserve something, it's no problem with w3compiler. Conversely, if you want w3compiler to strip out something specific, this can be easily indicated by using a special comment. However, for optimal safety and optimization, Web sites really should be optimized all at once so that all dependencies can be calculated and maintained.

w3compiler 1.1 offers remarkable control over which files and/or directories should be included or excluded. Developers can now easily exclude specific files and/or directories, as well as define and associate compressible file types to arbitrary extensions in the Code Optimization Settings dialog. For example, under the ASP tab in the Code Optimization Settings, w3compiler associates .asp, .aspx, and .asm files with this type of code optimization.

back to top


Does the w3compiler product work with FrontPage, Dreamweaver, etc.?
Yes. You can use the product with any markup generated by editors. Direct integration is also possible using the command line version of the w3compiler. An interim 1.x generation release will automate the setup of this process for Dreamweaver. However, because optimization is much better for a whole site at a time, we encourage developers to work with the w3compiler in that fashion rather than saving and optimizing a page at a time from an editor.

back to top


How do the w3compiler.com developers use the w3compiler?
Yes, we do eat our own dog food. View the source of this page right now to see this site optimized by w3compiler!

Port80's own developers open the w3compiler application, access a project file, and launch their editors from within w3compiler -- changes are made to the source code, saved in the editor -- then the w3compiler is there, ready to compile pages over to the target directory (in our case, the Web root of our test server). After testing is complete, we upload the compiled version of files from the test server to our live product server at www.w3compiler.com and www.port80software.com.

back to top


How does w3compiler handle semicolon usage in JavaScript?
Since we do a full parse of a page, w3compiler is able to insert semicolons (;) into markup instead of carriage returns to signal the end of a statement. There is minimal reduction in file size by doing this, but most importantly, it does result in a visually more difficult to understand (and therefore to hack) script.

back to top


What kind of JavaScript optimization does w3compiler support?
Probably the most sophisticated aspect of the w3compiler, JavaScript optimization employs a variety of techniques including:

  • Smart White Space Reduction
    w3compiler removes white space with awareness of semicolons and applies any necessary fixes to avoid breaking code. Comments can also be removed globally.
  • Object Remapping
    The tool remaps known JavaScript objects like window, navigator, document, etc. to short names. This significantly reduces file size!
  • User Defined Renaming
    The product renames any user defined names for variables, functions, and objects to their shortest possible value, with global and local awareness, and provides an exclusion mechanism as well (helpful for referencing external scripts). Depending on your coding style, this may save significant space.
  • Code Condensing
    w3compiler employs many small fix-ups like removing non-executed code, condensing variable declarations, remapping certain types of math expressions, and other byte shaving tricks similar to those employed in a standard optimizing compiler.
back to top


What kind of JavaScript can the w3compiler not handle?
By default, the safety level of the w3compiler is tuned to avoid JavaScript that it cannot handle, so you should feel safe optimizing these types of files in general. While you should always test code optimization first, w3compiler should compress most JavaScript flawlessly. The most troubling code that we see used is dynamically evaluated -- some forms of self-rewriting script cannot be determined with interpretation, which may depend on user conditions.

For the bold, the advanced features of w3compiler allow you to tune the software to avoid making default, conservative assumptions in optimization. If you know what you are doing, you can probably squeeze another 5-10% file size reduction out of some scripts by adjusting w3compiler's JavaScript safety settings.

back to top


Why does variable/function/object "x" not optimize?
For code safety reasons, if the w3compiler cannot determine full usage of a variable, identifies a variable used in eval statements, or recognizes a JavaScript keyword as a variable, the software will leave it alone. Of course, this can be overridden in the advanced configuration for JavaScript optimization.

back to top


Does w3compiler obfuscate JavaScript?
In the sense that it will be difficult to reverse engineer a script that is compiled, yes, w3compiler obfuscates. However, because more powerful source-level obfuscation often picks larger, complex variables that look similar (such as 1ll1l1l1 and 1l1||1|1) as substitutions, it does not really produce smaller code in many cases. We focus on, and have worked to master, optimization as opposed to better obfuscation. However, we may enable more difficult variable substitutions in an upcoming version if we see user demand. So far though, user feedback indicates speed and file size with basic obfuscation is more important than large file size with better obfuscation. Tell us what you think...

back to top


I code in classic ASP. What kind of optimization results can I expect?
w3compiler has been extensively tested with most common scripting languages, including ASP, CFM, PHP, and ASP.NET. Statically generated markup from scripting languages within dynamic pages will be optimized -- w3compiler is able to remove comments and white space from any print statements or other HTML, CSS, and JavaScript elements generated within an ASP or other scripted page. Of course, some scripted page elements must be dynamically generated at run-time, and therefore, it is not currently possible for w3compiler or any other code optimization tool to crunch every element of such pages. The extent to which the source code will be crunched will depend on the nature of the scripting language and the style of the programmer.

back to top


What about ColdFusion?
w3compiler optimizes CFM pages exceptionally well due to the tag-oriented approach of the ColdFusion scripting language. Optimizations are limited to white space removal and comments removal, but file size savings from these can be significant.

back to top


What about PHP?
With the release of version 1.1, w3compiler now supports optimization of PHP pages, including white space removal outside of PHP blocks, white space removal from echo and print functions within PHP blocks, and removal of comments.

back to top


File Name Remapping: What is the point of this feature?
The main benefit of remapping files is to reduce site-wide code size. Consider that, if you have a file called HM_Logo.gif in your images directory, it is likely you have code like

<img src="../images/HM_Logo.gif">

You could reduce markup size if you had instead

<img src=/0/h.gif">

but you would need to remap files all over the place.

w3compiler automates this process, making non-user observed URLs for CSS, JS, GIF, JPEG, and other included files much shorter in length and therefore further reducing them in size. This not only makes markup and script files smaller, but it also obfuscates your source code to a great extent. Since you keep the original files to work on, this change doesn't affect your Web site's maintainability, but it can dramatically improve its security and speed.

back to top


File Extension Removal: What is the benefit?
The main benefit of removing file extensions from within HTML markup is to support content negotiation as implemented by our PageXchanger product. We strongly believe in content negotiation because it abstracts away implementation details in Web sites and allows for clean URLs -- Not showing file extensions improves security and easily allows you to migrate or change implementation from one technology to another. However, before turning on these advanced features, understand that removing file extensions will break your site without PageXchanger or a similar filter in place on your Web server, so this feature is turned off by default in w3compiler. If you use PageXchanger for IIS or mod_negotiation for Apache, w3compiler will be an invaluable final step before deploying your site.

back to top


Can I remove index file names from links?
Very easily. Most well designed Web sites are configured to perform an automatic redirect or to return a default document for a request to a Web directory or an index page, making use of the index file name in links largely unnecessary. w3compiler makes the removal of this superfluous text easy to perform across your entire Web site. You may choose to remove index file names from internal links only, external links only, or both, depending on whether or not the link targets are configured to use default documents.

back to top


Speed up Your Site: Web Site Optimization by Andy King What if I want to optimize my code by hand? Any hints or resources to get me started?
The w3compiler was designed to save the lion's share of time and effort in manual code optimization by automating the process.

If you are a perfectionist who wants to code optimization tweaks by hand, or if you would like to delve deeper into code optimization, we recommend Andy King's book "Speed up Your Site: Web Site Optimization". You can purchase "Speed up Your Site" at Amazon.com.

back to top


What's with the compiler emphasis?
Software is compiled in traditional programming in order to optimize human readable code for machine reading, making the computing process more efficient, reducing duplication and redundancy. Until the w3compiler, this concept has not been applied to Web site and application code. We strongly believe that the code Web developers write for themselves should not be the same code that is delivered to end users. End users don't care about white space and well formatted and commented code any more than TV watchers care about what frequency their favorite show is broadcast at. As our CEO is fond of saying, "View Source should be a thing of the past." As evidenced by efforts at major Web sites like Google, simple page optimization is obviously a very good idea, but it needs to be safer, easier, and faster.

Enter the w3compiler.

back to top


Is this product associated with the World Wide Web Consortium (W3C)?
No. The name of the product is purposefully designed to suggest a focus on standards and to imply that this is a Web (e.g. www, w3, etc.) compiler. w3compiler is not a product of the W3C or its affiliates. However, the developers of w3compiler at Port80 Software are strong advocates of Web standards, have written books on HTML, XHTML, CSS and JavaScript, and one of the product's architects is a W3C member.

back to top


I thought Port80 Software was all about Web server software. What gives?
That's actually still true. Port80 Software is very committed to Web server module development, and this product started as an in-house tool designed for PageXchanger and httpZip customers to "prep" their sites for delivery. The w3compiler's value quickly outstripped its initial design and feedback from clients suggested a real need for a good Web compilation tool, so we formed a dedicated client software development group to work on this product. So far, the w3compiler is keeping the group busy, but our beta user feedback has been so enormous that Port80 may explore other client-side products in the near future.

back to top


I encountered some problems with version 1.0. Are these addressed in version 1.1?
Based on customer feedback about the initial release of w3compiler, we have corrected several bugs in version 1.1:

  • We've improved the parser to address problems encountered in extremely complex projects and to correct instances in which JavaScript affected ASP code.
  • File remapping is greatly improved.
  • Integrated w3compiler with the W3C online HTML Validator.
  • Tightened up the UI.
back to top


What features are coming up in version 2.0?
Obviously, we can't tell you everything, but we are planning on furthering JavaScript optimization in a few places and adding CSS rule reduction. We also will most likely provide better integration with Web editors and FTP clients. While these features are most in-demand from early beta customers of w3compiler, if you have an idea for an extension to the framework, please send us an e-mail (featurerequest@port80software.com), and you can get involved.

back to top

home | try | buy | faqs | support | contact
© 2002-2009 Port80 Software, Inc.