Diagnosing Performance Issues

作者 gopigment6fec49f4ce9d無授權條款22 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫2 天前更新

Execution skill. Use when a Pigment application has slow calculations, timeouts, or when diagnosing performance bottlenecks. Covers profiler interpretation, scope chip reading, systematic troubleshooting workflow, and iterative calculation optimization.

AI 產生的概覽

指導使用 Profiler、作用域標籤和系統化排查流程診斷 Pigment 計算緩慢問題。

功能
此技能提供診斷 Pigment 應用程式效能問題(例如計算緩慢和逾時)的說明。它說明如何開啟和閱讀 Profiler、解讀作用域標籤與 M/N 表示法、追蹤計算鏈,並分類作用域遺失、稠密化、交叉連接、迭代計算和存取權限重算等瓶頸。它也列出常見修正方法,以及記錄瓶頸、根因、建議修正和驗證的報告結構。
適用情境
當 Pigment 應用程式出現計算緩慢、逾時或疑似效能瓶頸時使用。也適用於使用者要求尋找瓶頸,或希望最佳化迭代計算和行事曆維度效能的情境。
執行需求
不包含指令碼,僅為說明文件。需要存取 Pigment 應用程式,並具備 Builder 或更高帳戶類型以使用 Profiler,同時需要使用者配合重現操作並重新分析更新。

Diagnose Pigment Performance Issues

Use when calculations are slow, timing out, or the user asks to find bottlenecks.

Open the Profiler on the Slow Metric

  1. Ask the user to reproduce the slow action (input change, import, scenario switch) so a fresh update exists in History. Updates are profiled for three days only.
  2. Open the Profiler via:
    • Application History: Sidebar > History > hover the update > Profile update
    • Block updates: Expand the Block on a Board > Block updates icon > three-dot menu > profile
    • Block Explorer: Open the Metric > profiling from the formula bar menu
  3. User must have Builder account type or above.
  4. In the Profiling pane, note total computation time and number of Blocks revised.
  5. Sort by Computation Duration (descending). Use Search to locate a specific Metric.
  6. Optionally filter Filter on path to this object to isolate upstream dependencies.

Read Scope Chips and M/N Notation

Each computation step shows a Scope value and colored chip.

Scope notation (M/N)

  • M/N = M Dimensions scoped out of N total in the Metric structure
  • 2/2 = full scope (ideal -- engine recalculates only impacted cells)
  • 2/3 = partial scope; investigate which Dimension lost scope
  • 0/N = no scope; full recomputation. Primary performance red flag.

Hover the Scope fraction to see which Dimension Items are scoped and which Dimensions pass to the next step. Bold M/N means scope passed downstream differs from the current step.

Scope chip colors

ChipMeaningAction
BlackScope preserved and passed downstreamGood — no action needed
BlueNew scope introduced (dimension added or newly constrained)Expected after filters/selects; verify it is intentional
GrayComputation triggered but output unchangedWasted work — investigate why the step ran

Goal: maximize scoped Dimensions (approach N/N) throughout the chain.

Trace Computation Chains

  1. Start at the slowest step (highest Computation Duration).
  2. Check its Scope chip and M/N value.
  3. If 0/N, walk upstream until you find where scope was lost.
  4. Hover each step to see dependency lists.
  5. For iterative calculations, the Profiler shows cycle-level timing; check each Metric individually.
  6. Distinguish Scheduled (gray bar) vs Execution (blue bar) time. Long gray bars indicate access-rights overhead.

Known scope-loss triggers

  • Assigns a constant value across Dimensions
  • Uses ADD (introduces unscoped Dimension)
  • Uses REMOVE on a scoped Dimension
  • Uses CUMULATE, PREVIOUS, PREVIOUSOF, PRORATA, MOVINGAVERAGE, or MOVINGSUM
  • Uses BY CONSTANT

Systematic Troubleshooting Workflow

  1. Profile the slow Metric after reproducing the user action.
  2. Identify the bottleneck: sort by Computation Duration; record the slowest step and time.
  3. Check scope chips on the slow step and its inputs. Scope loss (especially 0/N) is the most common culprit.
  4. Classify the cause: scope loss, densification, unnecessary REMOVE, cross-join from ADD, iterative calculation, or access-rights recomputation.
  5. Apply a fix (see patterns below). Change one thing at a time.
  6. Re-profile and compare before/after timing.
  7. Document original duration, fix applied, and new duration.

If scope is healthy but execution is still slow, investigate iterative calculations or large Dimension cardinality.

Fix Common Bottleneck Patterns

Scope loss after REMOVE

  • Symptom: Scope drops after REMOVE; downstream shows 0/N or partial scope.
  • Fix: Only REMOVE when aggregation is truly needed. Check if BY with a mapping Metric achieves the same result while preserving scope. Push filtering earlier with SELECT or FILTER.

Dense metrics from ISBLANK checks

  • Symptom: High calculated size / density; slow steps on ISBLANK or ISNOTBLANK formulas.
  • Fix: Replace with ISDEFINED / IFDEFINED to preserve sparsity.

Long iterative calculations (PREVIOUS over many periods)

  • Symptom: Slow execution proportional to time Dimension length.
  • Fix: See skill:iterating-with-previous-and-cycles for the full optimization guide (subsetting, CUMULATE/FILLFORWARD replacements, dimensionality reduction, expression grouping).

Large cross-joins from ADD

  • Symptom: Blue scope chip after ADD; M/N drops; execution time spikes.
  • Fix: Replace ADD with BY and a mapping Metric to allocate without introducing an unscoped Dimension.

Access rights recomputing for all users

  • Symptom: Long scheduled (gray) bars; AR Metrics appear early with 0/N scope.
  • Fix: Wrap AR formulas in IFDEFINED('Users roles', ...) — this is the mandatory guard that skips AR computation for users without role assignments. Optionally add IFDEFINED(User, ...) as an additional performance trim (not a substitute). See skill:writing-performant-formulas and skill:securing-with-access-rights.

Manage Calendar Dimension Performance

Daily calendars over many years amplify every iterative and unscoped calculation.

  • Prefer monthly grain unless daily resolution is a business requirement.
  • If daily is required, subset the Calendar to the relevant date range.
  • Flag Metrics dimensioned by full daily Calendar with PREVIOUS or CUMULATE as high-risk for timeouts (3-minute execution limit).

Tell the User When UI Action Is Required

The agent cannot perform these steps:

  • Performance Insights (avg/max/total execution time, density): Block Explorer > All Blocks > Metrics tab > Insights toggle.
  • Dependency diagram exploration: Block Explorer or Metric settings > dependency diagram.
  • Profiler access: User must click Profile update in History or Block updates.
  • Re-profile after fix: User must reproduce the action and profile the new update.

Report Findings

Structure every diagnosis as:

  1. Bottleneck: Metric name, step duration, scope (M/N), chip color
  2. Root cause: scope loss / iterative / cross-join / densification / access rights
  3. Recommended fix: specific formula change (one change at a time)
  4. Verification: ask user to re-profile and share before/after timing

Prioritize by Computation Duration impact. Fix scope loss before tuning iterative patterns.

When a profile marks an execution as having impacted data Members were viewing, treat those executions first: they gate what Members see refreshing. The others are deliberately deferred by the engine, so their extra contention alone is not a defect. Say "impacted viewed data" to the user, never the raw field name.

來源與署名

來源:gopigment/ai-plugins位於skills/diagnosing-performance-issues提交6fec49f

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架