Fossil SCM
Improved cross-page caching of wikiedit/fileedit bundle, reducing those pages to a single request of 10-13k once cache is warm. Fixed non-bundled JS distribution of fileedit and wikiedit.
Commit
20c50cd1e5ca52be02cc98eb819b5a4efe798621501be6d4a36c541ba03c2038
Parent
c515e5fd9f41fc3…
3 files changed
+11
+2
-2
+3
-2
+11
| --- src/builtin.c | ||
| +++ src/builtin.c | ||
| @@ -700,10 +700,21 @@ | ||
| 700 | 700 | ** returns true. As a special case, if this is called more than once |
| 701 | 701 | ** in bundled mode, subsequent calls are a no-op. |
| 702 | 702 | ** |
| 703 | 703 | ** If the current JS delivery mode is *not* JS_BUNDLED then this |
| 704 | 704 | ** function is a no-op and returns false. |
| 705 | +** | |
| 706 | +** Minor caveat: the purpose of emitting all of the fossil.XYZ JS APIs | |
| 707 | +** at once is to reduce over-the-wire transfers by enabling cross-page | |
| 708 | +** caching, but if there are other JS scripts pending via | |
| 709 | +** builtin_request_js() when this is called then they will be included | |
| 710 | +** in the JS request emitted by this routine, resulting in a different | |
| 711 | +** script URL than if they were not included. Thus, if a given page | |
| 712 | +** has its own scripts to install via builtin_request_js(), they | |
| 713 | +** should, if possible, be delayed until after this is called OR the | |
| 714 | +** page should call builtin_fulfill_js_requests() to flush the request | |
| 715 | +** queue before calling this routine. | |
| 705 | 716 | */ |
| 706 | 717 | int builtin_bundle_all_fossil_js_apis(void){ |
| 707 | 718 | static int bundled = 0; |
| 708 | 719 | if(JS_BUNDLED == builtin_get_js_delivery_mode()){ |
| 709 | 720 | if(!bundled){ |
| 710 | 721 |
| --- src/builtin.c | |
| +++ src/builtin.c | |
| @@ -700,10 +700,21 @@ | |
| 700 | ** returns true. As a special case, if this is called more than once |
| 701 | ** in bundled mode, subsequent calls are a no-op. |
| 702 | ** |
| 703 | ** If the current JS delivery mode is *not* JS_BUNDLED then this |
| 704 | ** function is a no-op and returns false. |
| 705 | */ |
| 706 | int builtin_bundle_all_fossil_js_apis(void){ |
| 707 | static int bundled = 0; |
| 708 | if(JS_BUNDLED == builtin_get_js_delivery_mode()){ |
| 709 | if(!bundled){ |
| 710 |
| --- src/builtin.c | |
| +++ src/builtin.c | |
| @@ -700,10 +700,21 @@ | |
| 700 | ** returns true. As a special case, if this is called more than once |
| 701 | ** in bundled mode, subsequent calls are a no-op. |
| 702 | ** |
| 703 | ** If the current JS delivery mode is *not* JS_BUNDLED then this |
| 704 | ** function is a no-op and returns false. |
| 705 | ** |
| 706 | ** Minor caveat: the purpose of emitting all of the fossil.XYZ JS APIs |
| 707 | ** at once is to reduce over-the-wire transfers by enabling cross-page |
| 708 | ** caching, but if there are other JS scripts pending via |
| 709 | ** builtin_request_js() when this is called then they will be included |
| 710 | ** in the JS request emitted by this routine, resulting in a different |
| 711 | ** script URL than if they were not included. Thus, if a given page |
| 712 | ** has its own scripts to install via builtin_request_js(), they |
| 713 | ** should, if possible, be delayed until after this is called OR the |
| 714 | ** page should call builtin_fulfill_js_requests() to flush the request |
| 715 | ** queue before calling this routine. |
| 716 | */ |
| 717 | int builtin_bundle_all_fossil_js_apis(void){ |
| 718 | static int bundled = 0; |
| 719 | if(JS_BUNDLED == builtin_get_js_delivery_mode()){ |
| 720 | if(!bundled){ |
| 721 |
+2
-2
| --- src/fileedit.c | ||
| +++ src/fileedit.c | ||
| @@ -1986,14 +1986,13 @@ | ||
| 1986 | 1986 | "file/check-in combination are discarded.</li>"); |
| 1987 | 1987 | CX("</ul>"); |
| 1988 | 1988 | } |
| 1989 | 1989 | CX("</div>"/*#fileedit-tab-help*/); |
| 1990 | 1990 | |
| 1991 | - builtin_request_js("sbsdiff.js"); | |
| 1992 | 1991 | if(!builtin_bundle_all_fossil_js_apis()){ |
| 1993 | 1992 | builtin_emit_fossil_js_apis("fetch", "dom", "tabs", "confirmer", |
| 1994 | - "storage", 0); | |
| 1993 | + "storage", "popupwidget", 0); | |
| 1995 | 1994 | } |
| 1996 | 1995 | /* |
| 1997 | 1996 | ** Set up a JS-side mapping of the AJAX_RENDER_xyz values. This is |
| 1998 | 1997 | ** used for dynamically toggling certain UI components on and off. |
| 1999 | 1998 | ** Must come after window.fossil has been intialized and before |
| @@ -2000,10 +1999,11 @@ | ||
| 2000 | 1999 | ** fossil.page.fileedit.js. Potential TODO: move this into the |
| 2001 | 2000 | ** window.fossil bootstrapping so that we don't have to "fulfill" |
| 2002 | 2001 | ** the JS multiple times. |
| 2003 | 2002 | */ |
| 2004 | 2003 | ajax_emit_js_preview_modes(1); |
| 2004 | + builtin_request_js("sbsdiff.js"); | |
| 2005 | 2005 | builtin_request_js("fossil.page.fileedit.js"); |
| 2006 | 2006 | builtin_fulfill_js_requests(); |
| 2007 | 2007 | { |
| 2008 | 2008 | /* Dynamically populate the editor, display any error in the err |
| 2009 | 2009 | ** blob, and/or switch to tab #0, where the file selector |
| 2010 | 2010 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1986,14 +1986,13 @@ | |
| 1986 | "file/check-in combination are discarded.</li>"); |
| 1987 | CX("</ul>"); |
| 1988 | } |
| 1989 | CX("</div>"/*#fileedit-tab-help*/); |
| 1990 | |
| 1991 | builtin_request_js("sbsdiff.js"); |
| 1992 | if(!builtin_bundle_all_fossil_js_apis()){ |
| 1993 | builtin_emit_fossil_js_apis("fetch", "dom", "tabs", "confirmer", |
| 1994 | "storage", 0); |
| 1995 | } |
| 1996 | /* |
| 1997 | ** Set up a JS-side mapping of the AJAX_RENDER_xyz values. This is |
| 1998 | ** used for dynamically toggling certain UI components on and off. |
| 1999 | ** Must come after window.fossil has been intialized and before |
| @@ -2000,10 +1999,11 @@ | |
| 2000 | ** fossil.page.fileedit.js. Potential TODO: move this into the |
| 2001 | ** window.fossil bootstrapping so that we don't have to "fulfill" |
| 2002 | ** the JS multiple times. |
| 2003 | */ |
| 2004 | ajax_emit_js_preview_modes(1); |
| 2005 | builtin_request_js("fossil.page.fileedit.js"); |
| 2006 | builtin_fulfill_js_requests(); |
| 2007 | { |
| 2008 | /* Dynamically populate the editor, display any error in the err |
| 2009 | ** blob, and/or switch to tab #0, where the file selector |
| 2010 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1986,14 +1986,13 @@ | |
| 1986 | "file/check-in combination are discarded.</li>"); |
| 1987 | CX("</ul>"); |
| 1988 | } |
| 1989 | CX("</div>"/*#fileedit-tab-help*/); |
| 1990 | |
| 1991 | if(!builtin_bundle_all_fossil_js_apis()){ |
| 1992 | builtin_emit_fossil_js_apis("fetch", "dom", "tabs", "confirmer", |
| 1993 | "storage", "popupwidget", 0); |
| 1994 | } |
| 1995 | /* |
| 1996 | ** Set up a JS-side mapping of the AJAX_RENDER_xyz values. This is |
| 1997 | ** used for dynamically toggling certain UI components on and off. |
| 1998 | ** Must come after window.fossil has been intialized and before |
| @@ -2000,10 +1999,11 @@ | |
| 1999 | ** fossil.page.fileedit.js. Potential TODO: move this into the |
| 2000 | ** window.fossil bootstrapping so that we don't have to "fulfill" |
| 2001 | ** the JS multiple times. |
| 2002 | */ |
| 2003 | ajax_emit_js_preview_modes(1); |
| 2004 | builtin_request_js("sbsdiff.js"); |
| 2005 | builtin_request_js("fossil.page.fileedit.js"); |
| 2006 | builtin_fulfill_js_requests(); |
| 2007 | { |
| 2008 | /* Dynamically populate the editor, display any error in the err |
| 2009 | ** blob, and/or switch to tab #0, where the file selector |
| 2010 |
+3
-2
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -1285,16 +1285,17 @@ | ||
| 1285 | 1285 | CX("<h2>Wiki Name Rules</h2>"); |
| 1286 | 1286 | well_formed_wiki_name_rules(); |
| 1287 | 1287 | CX("</div>"/*#wikiedit-tab-save*/); |
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | - builtin_request_js("sbsdiff.js"); | |
| 1291 | 1290 | if(!builtin_bundle_all_fossil_js_apis()){ |
| 1292 | 1291 | builtin_emit_fossil_js_apis("fetch", "dom", "tabs", "confirmer", |
| 1293 | - "storage", "page.wikiedit", 0); | |
| 1292 | + "storage", "popupwidget", 0); | |
| 1294 | 1293 | } |
| 1294 | + builtin_request_js("sbsdiff.js"); | |
| 1295 | 1295 | builtin_request_js("fossil.page.wikiedit.js"); |
| 1296 | + builtin_fulfill_js_requests(); | |
| 1296 | 1297 | /* Dynamically populate the editor... */ |
| 1297 | 1298 | style_emit_script_tag(0,0); |
| 1298 | 1299 | { |
| 1299 | 1300 | /* Render the current page list to save us an XHR request |
| 1300 | 1301 | during page initialization. This must be OUTSIDE of |
| 1301 | 1302 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1285,16 +1285,17 @@ | |
| 1285 | CX("<h2>Wiki Name Rules</h2>"); |
| 1286 | well_formed_wiki_name_rules(); |
| 1287 | CX("</div>"/*#wikiedit-tab-save*/); |
| 1288 | } |
| 1289 | |
| 1290 | builtin_request_js("sbsdiff.js"); |
| 1291 | if(!builtin_bundle_all_fossil_js_apis()){ |
| 1292 | builtin_emit_fossil_js_apis("fetch", "dom", "tabs", "confirmer", |
| 1293 | "storage", "page.wikiedit", 0); |
| 1294 | } |
| 1295 | builtin_request_js("fossil.page.wikiedit.js"); |
| 1296 | /* Dynamically populate the editor... */ |
| 1297 | style_emit_script_tag(0,0); |
| 1298 | { |
| 1299 | /* Render the current page list to save us an XHR request |
| 1300 | during page initialization. This must be OUTSIDE of |
| 1301 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1285,16 +1285,17 @@ | |
| 1285 | CX("<h2>Wiki Name Rules</h2>"); |
| 1286 | well_formed_wiki_name_rules(); |
| 1287 | CX("</div>"/*#wikiedit-tab-save*/); |
| 1288 | } |
| 1289 | |
| 1290 | if(!builtin_bundle_all_fossil_js_apis()){ |
| 1291 | builtin_emit_fossil_js_apis("fetch", "dom", "tabs", "confirmer", |
| 1292 | "storage", "popupwidget", 0); |
| 1293 | } |
| 1294 | builtin_request_js("sbsdiff.js"); |
| 1295 | builtin_request_js("fossil.page.wikiedit.js"); |
| 1296 | builtin_fulfill_js_requests(); |
| 1297 | /* Dynamically populate the editor... */ |
| 1298 | style_emit_script_tag(0,0); |
| 1299 | { |
| 1300 | /* Render the current page list to save us an XHR request |
| 1301 | during page initialization. This must be OUTSIDE of |
| 1302 |