Module:RenderProfileとは? わかりやすく解説

Weblio 辞書 > 辞書・百科事典 > 百科事典 > Module:RenderProfileの意味・解説 

Module:RenderProfile

出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2013/04/09 02:51 UTC 版)

このモジュールについての説明文ページを Module:RenderProfile/doc に作成できます

p = {};
 
function p.partition( frame )
    local page = frame.args[1];
    local finish = frame.args[2] or "true"
 
    page = page:match( "^%s*(.-)%s*$" );
 
    local tt = mw.title.new( page );
    if tt == nil then
        return "No such page";
    end
 
    local content = tt:getContent();
    local result = '';
    local blocks = {};
    local name;
    local current;
 
    -- Remove table confusion
    content = content:gsub( "[^{]({|)", "" );
    content = content:gsub( "(|})[^}]", "" );
 
    for block in content:gmatch( "%b{}" ) do
        name = block:match( "^{{%s*([^|}]-)%s*[|}]" );
        if name ~= nil then
            name = name:lower();
            current = blocks[ name ];
            if current == nil then
                current = {};
            end
            table.insert( current, block );
 
            blocks[ name ] = current;
        end
    end
 
    local blocks2 = {};
    for k, v in pairs( blocks ) do
        table.insert( blocks2, {k, v} );
    end
    blocks = blocks2;
    table.sort( blocks, comp );
 
    local count;
    result = "This is a template rendering profile for [[" .. page .. "]].\n\n";
    result = result .. "This tool measures the time taken for various templates on the page to be expanded and converted into wikitext " ..
        " (similar to the function of [[Special:ExpandTemplates]]).  " ..
        "This only captures a portion of the total time required to render a page, but will often identify templates that render slowly.  " ..
        "In particular, this tool does not measure the time required by the parser to convert wikitext into HTML, which may be " ..
        "a significant fraction of the total rendering time in many cases.\n\n"
 
    result = result .. "{| class='wikitable sortable' \n|-\n!Template !! Iterations !! Time (s) \n|-\n";
 
    for _, v in ipairs( blocks ) do
        k = v[1];
        v = v[2];
        count = #v;
        v = table.concat(v);
        v = v:gsub( "=", "{{=}}" );
        v = v:gsub( "|", "{{!}}" );
        result = result .. "| " .. k .. " || " ..
            tostring( count ) .. " || " ..
            "{{#invoke: RenderProfile | time | " .. v .. "}}" .. "\n|-\n";
    end
    result = result .. "|}";
 
    finish = finish:match( "^%s*(.-)%s*$");
    if finish:lower() == 'true' then
        return frame:preprocess( result );
    else
        return result;
    end
end
 
function p.time( frame )    
    local start = os.clock();
    local start2 = os.time();
 
    local test = frame.args[1];
    test = frame:preprocess( test );
 
    local stop = os.clock();
    local stop2 = os.time();
 
    return string.format("%5.3f", stop - start);
end
 
function comp( a, b )
    return #(a[2]) > #(b[2]);
end
 
return p



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Module:RenderProfileのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Module:RenderProfileのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
ウィキペディアウィキペディア
All text is available under the terms of the GNU Free Documentation License.
この記事は、ウィキペディアのModule:RenderProfile (改訂履歴)の記事を複製、再配布したものにあたり、GNU Free Documentation Licenseというライセンスの下で提供されています。 Weblio辞書に掲載されているウィキペディアの記事も、全てGNU Free Documentation Licenseの元に提供されております。

©2025 GRAS Group, Inc.RSS