Revision: 5763 Author: sp...@google.com Date: Tue Jul 21 13:42:16 2009 Log: Updated the code-splitting wiki page with: the current splitting strategy and the current UI for browsing dependencies. http://code.google.com/p/google-web-toolkit/source/detail?r=5763
Modified: /wiki/CodeSplitting.wiki ======================================= --- /wiki/CodeSplitting.wiki Thu Jun 11 13:10:53 2009 +++ /wiki/CodeSplitting.wiki Tue Jul 21 13:42:16 2009 @@ -131,44 +131,36 @@ ==The results of code splitting== -THIS SECTION IS OUT OF DATE. -Lex Spoon (June 11, 2009) - Before going further, it is important to understand exactly what fragments the code splitter divides your code into. That way you can examine how the splitting went and work towards improving it. -One very important fragment is the initial download. This is fragment -number 0, and for the iframe linker it is emitted as a -file whose name ends with cache.html. When the application starts up, -the initial-download fragment is loaded. This fragment includes all -the code necessary to run the application up to any split point but -not past. When you start improving your code splitting, you should -probably start by trying to reduce the size of the initial download -fragment. Reducing this fragment causes the application to start up -quickly. +One very important fragment is the initial download. For the iframe +linker it is emitted as a file whose name ends with cache.html. When +the application starts up, the initial-download fragment is loaded. +This fragment includes all the code necessary to run the application +up to any split point but not past. When you start improving your code +splitting, you should probably start by trying to reduce the size of the +initial download fragment. Reducing this fragment causes the application +to start up quickly. There are a number of other code fragments generated in addition to this initial one. For the iframe linker, they are located -underneath a directory named deferredjs. For each split point -*i*, where the split points are numbered from 1 through *m*, -the following three fragments are generated: - -*Fragment i: an exclusive fragment.* This fragment includes all code -needed once split point *i* has been reached, but never needed until -then. It includes code that is exclusively needed by split point *i*. - -*Fragment m + 2`*`i - 1: a base fragment.* This fragment includes -the code needed to run split point *i*, assuming that split point *i* -is the first fragment to be reached. This one code download is -enough to run split point *i*. - -*Fragment m + 2`*`i: a leftovers fragment.* This fragment includes code -that is not in any of: any exclusive fragment, the initial download -fragment, or the base fragment for split point *i*. Once a base -fragment has loaded, the associated leftovers fragment is immediately -loaded in the background. It's a secondary concern, but once -the initial download is good, you might want to try and move code -from leftovers into exclusive fragments. +underneath a directory named deferredjs. Each split point +in the program will have an associated code fragment. In addition, +there is a "leftovers" code fragment for code that is not associated +with any specific split point. + +The code fragment associated with a split point is of +one of two kinds. Most frequently, it is an "exclusive" fragment. +An exclusive fragment contains code that is only needed once +that split point is activated. If the split point is an "initial" +split point, then it gets an "initial" code fragment rather than +an "exclusive" one. Unlike an exclusive fragment, an initial fragment +does not rely on anything in the leftovers fragment. However, +an initial fragment can only be loaded in its designated +initial load sequence; exclusive fragments have the benefit that +they can be loaded in any order. ==The Story of Your Compile (SOYC)== @@ -220,21 +212,15 @@ ==Fragment breakdown== -_This section is speculative, but is left as a placeholder until -all of the details are worked out._ - Since you are working on code splitting, you will next want to look at -the way the application splits up. Fragment 0 is the initial download, -and the others are described in the above section on the results of code -splitting. You can look both at the overall sizes of the fragments as well -as the contents of each one. +the way the application splits up. Click on any code subset +to see a size breakdown of the code in that fragment. The "total program" +option describes all of the code in the program. The other +options all correspond to individual code fragments. ==Dependencies== -_This section is speculative, but is left as a placeholder -until all of the details are worked out._ - At some point you will try to get something moved out of the initial download fragment, but the GWT compiler will put it there anyway. Sometimes you can quickly figure out why, but other times it will not @@ -242,22 +228,24 @@ dependencies that are reported in the SOYC report. The most common example is that you expected something to be left out -of the initial download, but it was not. To find out why, go to that item -in the dependencies report, and you can look at a chain of dependencies -leading back to the application's main entry point. This is the chain +of the initial download, but it was not. To find out why, browse to that +item via the "initial download" code subset. Once you click on the item, +you can look at a chain of dependencies leading back to the application's +main entry point. This is the chain of dependencies that causes GWT to think the item must be in the initial download. Try to rearrange the code to break one of the links in that chain. A less common example is that you expected an item to be exclusive to some split point, but actually it's only included in leftover -fragments. In this case, look in the report at the dependencies -used to determine exclusive fragment for the split point you are -interested in. This lists all items not included in the exclusive fragment. -If you click on any of them, you will get a dependency chain where all -code in the chain is also not believed to be exclusive to that split point. -You should try to break a link in that chain. - +fragments. In this case, browse to the item via the "total program" +code subset. You will then get a page describing where the code of +that item ended up. If the item is not exclusive to any split point, +then you will be shown a list of all split points. If you click on any +of them, you will be shown a dependency chain for the item that +does not include the split point you selected. To get the item +exclusive to some split point, choose a split point, click on it, +and then break a link in the dependency chain that comes up. =Common coding patterns= --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---