Page MenuHomePhabricator

setMetadataValues is O(n²); rewrite to O(n)
Closed, ResolvedPublic

Description

setMetadataValues (called from WikifunctionsObjects.js:430, the top-level result-envelope assembly) walks the singly-linked metadata list once per key being set. For n metadata entries that is O(n²) where O(n) is achievable, on the hot path of every orchestrate call.

Desired behavior/Acceptance criteria

  • Rewrite setMetadataValues in function-schemata to walk the list once: either append in a batch at the tail, or build the list bottom-up from the new entries.
  • Paired MR in function-schemata; submodule bump in function-orchestrator.
  • All existing tests pass.
  • Micro-benchmark the orchestrate-end overhead in isolation and confirm the improvement scales with metadata count.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Jdforrester-WMF renamed this task from Parallelise remaining independent awaits with Promise.all to setMetadataValues is O(n²); rewrite to O(n).May 14 2026, 4:21 PM
Jdforrester-WMF removed Jdforrester-WMF as the assignee of this task.
Jdforrester-WMF updated the task description. (Show Details)
Jdforrester-WMF updated the task description. (Show Details)
Jdforrester-WMF changed the task status from Open to In Progress.May 14 2026, 5:23 PM
Jdforrester-WMF claimed this task.
Jdforrester-WMF triaged this task as Medium priority.

Change #1290095 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] Update function-schemata sub-module to HEAD (09acb0e)

https://gerrit.wikimedia.org/r/1290095

Change #1290095 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Update function-schemata sub-module to HEAD (09acb0e)

https://gerrit.wikimedia.org/r/1290095

Change #1297141 had a related patch set uploaded (by Jforrester; author: Jforrester):

[operations/deployment-charts@master] wikifunctions: Upgrade evaluators from 2026-05-19-171108 to 2026-06-03-023342

https://gerrit.wikimedia.org/r/1297141

Change #1297142 had a related patch set uploaded (by Jforrester; author: Jforrester):

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-05-19-223625 to 2026-06-03-020126

https://gerrit.wikimedia.org/r/1297142

Change #1297141 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade evaluators from 2026-05-19-171108 to 2026-06-03-023342

https://gerrit.wikimedia.org/r/1297141

Change #1297142 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-05-19-223625 to 2026-06-03-020126

https://gerrit.wikimedia.org/r/1297142