kumascript: Optimize wiki.page

RESOLVED FIXED

Status

developer.mozilla.org
Wiki pages
P2
normal
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: lorchard, Assigned: lorchard)

Tracking

Details

(Whiteboard: u=contributor c=wiki s=2012-05-22 p=)

(Assignee)

Description

6 years ago
In building DekiScript API shims, I found wiki.page. This allows one page to include the content of another page, with macros evaluated and class="noinclude" blocks omitted.

As it happens, some pages use this liberally and that generates a lot of HTTP requests. en/XUL/textbox, for one, generates a few hundred requests to build that page from dozens of others.

Part of this can be addressed with bug 747151, by minimizing how many requests kumascript needs to make to kuma for auto-required libs and other templates.

bug 747160 might help too, if wiki.page can use memcache to cache some of its own results.
(Assignee)

Updated

6 years ago
Blocks: 747145
(Assignee)

Updated

6 years ago
Depends on: 747160, 747151
(Assignee)

Comment 1

6 years ago
And here's a peek at the code from http://mdn.lmorchard.com/en-US/docs/en-US/Template:DekiScript:Wiki


    // Retrieve the content of a document for inclusion
    // TODO: NEED CACHING HERE, BADLY!
    page: function (path) {
        var p = kuma.url.parse(env.url, true);
        var base = p.protocol + '//' + p.host + '/en-US/docs/';           
        var doc_url = base + path + '?raw=1&macros=1&include=1';
        var opts = { method: 'GET', url: doc_url };
        var result = '';
 
        var f = new Future();
        request(opts, function (err, resp, body) {
            if (resp && 200 == resp.statusCode) { result = body; }
            f.return();
        });
        f.wait();
         
        return result;       
    },
(Assignee)

Comment 2

6 years ago
Maybe part of this optimization is to set really long expiration times on cached results on the KumaScript side. Then, invalidate cache entries from the Kuma script side when pages are saved. This would assume a shared naming convention in the cache on both sides.

Updated

6 years ago
Whiteboard: u=contributor c=wiki s=2012-05-22
(Assignee)

Comment 4

6 years ago
Merged: https://github.com/mozilla/kumascript/commit/736845b167278dbcf3c452bb2a320a255b5767e0
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED

Updated

6 years ago
Blocks: 710728
No longer blocks: 659364

Updated

6 years ago
Priority: -- → P2
Retroactively setting assignee to Les.
Assignee: nobody → lorchard
Whiteboard: u=contributor c=wiki s=2012-05-22 → u=contributor c=wiki s=2012-05-22 p=
Version: Kuma → unspecified
Component: Website → Landing pages
Product: Mozilla Developer Network → Mozilla Developer Network
You need to log in before you can comment on or make changes to this bug.