Skip to content

Commit e227f31

Browse files
updating markdown formatting skill and fixing mathematical expression formatting
1 parent df5a6e7 commit e227f31

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/skills/markdown-component-edit/references/component-patterns.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,19 @@ Rules:
8686
- Keep each tab roughly comparable in length and detail.
8787
- Avoid hiding critical sequential instructions inside tabs unless the user chooses one path.
8888

89+
## Mathematical expressions
8990

91+
To display a mathematical expression inline, encase the expression in `\(...\)`.
92+
93+
For example:
94+
95+
```md
96+
\(\sqrt{re^2 + im^2}\)
97+
```
98+
To display a mathematical expression in a new line, encase the expression in `$$...$$`.
99+
100+
For example:
101+
102+
```md
103+
$$re_{new} = re_z^2 - im_z^2 + re_c$$
104+
```

content/learning-paths/servers-and-cloud-computing/performix-mcp-agent/4-optimize.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The agent will typically surface these optimizations itself based on the profili
2323

2424
### Eliminate the sqrt in the escape check
2525

26-
The inner loop in `Mandelbrot::getIterations` calls `std::abs(z)` on every iteration to check whether the point has escaped. `std::abs` for `std::complex<double>` computes $\sqrt{re^2 + im^2}$ via `hypotf64` — a full square root on every iteration. The escape condition `abs(z) > THRESHOLD` is mathematically equivalent to `re² + im² > THRESHOLD²`, so the square root is never needed.
26+
The inner loop in `Mandelbrot::getIterations` calls `std::abs(z)` on every iteration to check whether the point has escaped. `std::abs` for `std::complex<double>` computes \(\sqrt{re^2 + im^2}\) via `hypotf64` — a full square root on every iteration. The escape condition \(abs(z) > THRESHOLD\) is mathematically equivalent to \(re^2 + im^2 > THRESHOLD^2\), so the square root is never needed.
2727

2828
Ask the agent to apply the fix, rebuild, and re-profile in one step. If the agent hasn't already proposed this change, use the following prompt:
2929

@@ -45,7 +45,7 @@ The hotspot distribution shifts: `getIterations` drops from 28.5% to 18.4% self-
4545

4646
With `hypotf64` and `__complex_abs` removed, the profile now shows `std::complex` operator symbols (`operator+`, `operator*=`, `operator*`, `operator+=`, `__muldc3`, `__rep`) collectively consuming the majority of CPU time. These are all function-call overhead: the debug build disables inlining, so every arithmetic operation on `std::complex<double>` dispatches through the C++ standard library machinery.
4747

48-
The fix is to replace `std::complex<double>` in `getIterations` with plain `double` variables for the real and imaginary parts. The Mandelbrot iteration $z_{n+1} = z_n^2 + c$ expands algebraically to:
48+
The fix is to replace `std::complex<double>` in `getIterations` with plain `double` variables for the real and imaginary parts. The Mandelbrot iteration \(z_{n+1} = z_n^2 + c\) expands algebraically to:
4949

5050
$$re_{new} = re_z^2 - im_z^2 + re_c$$
5151
$$im_{new} = 2 \cdot re_z \cdot im_z + im_c$$

0 commit comments

Comments
 (0)