My favorites | Sign in
Google
                
New issue | Search
for
| Advanced search | Search tips
Issue 599: PATCH to reduce size of generated JavaScript
4 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  scottb@google.com
Closed:  May 2007
Type-Enhancement
Priority-High
Milestone-1_4_RC
Category-Compiler


Sign in to add a comment
 
Reported by sandymac, Jan 16, 2007
GWT Release:
1.3.1

Detailed description:
GWT's Java to JavaScript compiler currently places a space around every
binary operator (=,+,-,==, etc), for the most part this isn't needed to
distinguish operators from variables or expressions ("instanceof" and "in"
are the exceptions). The one place I can think of where this may cause a
problem is with unary operators (--,++,!,-) adjacent to binary operators
because then it's not clear what some character sequences mean (in
"foo---bar" is foo decremented or is bar?). To address this I added spaces
before or after unary operators to prevent that confusion.

While not the optimal solution, this patch saves bytes because binary
operators are more common than unary operators and even if they weren't
unary operators only need one space to be unambiguous while binary
operators currently use two spaces.

In my testing this patch saves almost 6% on the cache.html files sizes.

Links to the relevant GWT Developer Forum posts:
http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_frm/thread/0a78989904807771/2aac13704f6e8d79?#2aac13704f6e8d79
gwt-jjs-save-bits.patch
2.2 KB Download
Comment 1 by gwt.team.scottb, Jan 16, 2007
Thanks, Sandy!
Status: Accepted
Owner: gwt.team.scottb
Labels: -Type-Defect -Priority-Medium Type-Enhancement Priority-High Milestone-1_4_RC
Comment 2 by gwt.team.scottb, Feb 02, 2007
This is great, I'm seeing the same reduction in size across the board.
Status: Started
Comment 3 by gwt.team.scottb, Feb 05, 2007
Submitted as r356.
Status: FixedNotReleased
Comment 4 by gwt.team.bruce, May 23, 2007
(No comment was entered for this change.)
Labels: Category-Compiler
Comment 5 by gwt.team.bruce, May 29, 2007
Changing to Fixed status with GWT 1.4 RC release
Status: Fixed
Comment 6 by sumitcha...@google.com, Apr 28, 2008
 
Owner: scottb
Sign in to add a comment