Repository navigation
Benchmarks
The headline figures and the live dashboard below were measured for 1.30.0 on an AMD Ryzen 9 9950X3D (16C/32T) running
Windows 11, with .NET 10.0.15, RyuJIT, a Release build and BenchmarkDotNet 0.15.8, at below-normal priority. The tables from
Streaming to Technical indicators were measured on an AMD Ryzen 9 3950X (16C/32T, 3.49 GHz) with .NET 10.0.6, for releases before
1.30.0, and are not measured again here. The full per-suite tables and their history, each section named for the release it was
measured on, are in BENCHMARKS.md.
The mean of three rounds of BenchmarkDotNet's short job on the 9950X3D. The column of the v1.9.0 era is the figure the same scenario had then, on the 3950X; a dash means the benchmark of that release measured something else. A figure that is drawn again after a change is a draw of the changed subplot; one drawn again unchanged is handed the drawing it kept.
| Scenario | v1.9.0 era | 1.30.0 | allocated | Note |
|---|---|---|---|---|
| SVG, a 100-point line drawn again after a change | — | 14.5 µs | 106.5 KB | |
| SVG, a 3×3 grid of subplots, one changed | — | 244 µs | 221.4 KB | |
| SVG, a 10,000-point line drawn again after a change | — | 533 µs | 808.6 KB | |
| SVG with LTTB downsample (100 000 points to 2 000), drawn again | 1.78 ms | 168 µs | 122.8 KB | |
| JSON round-trip (Figure ⇄ JSON) | 40 µs | 27.9 µs | 33.6 KB | |
| PNG export via SkiaSharp (simple) | 27 ms | 8.7 ms | 51.4 KB | |
| PDF export (simple / complex) | — | 11.1 / 21.6 ms | 1.7 / 2.2 MB | |
SIMD Vec.Sum / Vec.Mean on 100 000 pts |
19 µs | 4.6 / 4.5 µs | 0 B | |
TransformBatch (AVX) on 100 000 pts |
208 µs | 72 µs | 1.5 MB |
| Benchmark | Result |
|---|---|
RingBuffer.Append |
40M ops/sec (single-writer, 100K capacity) |
RingBuffer.ToArray (10K snapshot) |
190K snapshots/sec |
| StreamingLine: 100K appends + snapshot | 13 ms total |
| Scenario | Buffer | Append rate | Render FPS | Memory |
|---|---|---|---|---|
| Dashboard | 1K | 1/sec | 1 | 16 KB |
| Telemetry | 10K | 100/sec | 30 | 640 KB |
| Oscilloscope | 100K | 10K/sec | 60 | 800 KB |
| Trading (OHLC) | 5K | 10/sec | 10 | 160 KB |
The ring buffer is never the bottleneck; rendering is. At 30 fps the snapshot takes under a microsecond, so each frame still has about 32 ms left.
| Projection | ops/sec | Projection | ops/sec | |
|---|---|---|---|---|
| Sinusoidal | 83M | Stereographic | 24M | |
| NaturalEarth | 77M | EqualEarth | 19M | |
| Robinson | 33M | Orthographic | 17M | |
| AlbersEqualArea | 29M | PlateCarree | 16M | |
| Mercator | 25M | LambertConformal | 16M | |
| TransverseMercator | 14M | |||
| AzimuthalEquidistant | 13M | |||
| Mollweide | 6M |
Every projection exceeds 5M/sec. Projecting all 177 countries takes under 1 ms, even with Mollweide. Natural Earth 110m coastlines load in 5 ms (134 features). Countries load in 48 ms (177 features) and are then cached.
| Benchmark | Result |
|---|---|
Parse \sum_{i=0}^{n} \frac{1}{i!} = e
|
473K parses/sec |
Parse \begin{pmatrix} a & b \\ c & d \end{pmatrix}
|
554K parses/sec |
| 30 theme presets loaded | 370 µs |
| Chart | Time | Allocated |
|---|---|---|
| Simple line (100 pts) | 94 µs | 136 KB |
| Line + scatter + bar | 109 µs | 133 KB |
| 3×3 subplot grid | 754 µs | 933 KB |
| Treemap (6 nodes) | 60 µs | 109 KB |
| Sankey (4 nodes, 4 links) | 63 µs | 118 KB |
| Polar line (50 pts) | 33 µs | 56 KB |
| 3D surface (10×10) | 69 µs | 124 KB |
| 3D surface + directional lighting | 82 µs | 148 KB |
| Line + legend (3 series) | 140 µs | 214 KB |
| Large line (10K pts) | 3.1 ms | 3.7 MB |
| Large line (100K pts, LTTB→2K) | 1.3 ms | 2.4 MB |
Every indicator completes in under 3.3 ms. Multiple indicators run in parallel on separate cores.
| Indicator | Time | Indicator | Time | |
|---|---|---|---|---|
| SMA(20) | 195 µs | MACD(12,26,9) | 1.50 ms | |
| VWAP | 238 µs | ParabolicSAR | 1.21 ms | |
| EquityCurve | 226 µs | CCI(20) | 2.16 ms | |
| EMA(20) | 491 µs | BollingerBands(20) | 2.23 ms | |
| OBV | 645 µs | ADX(14) | 2.43 ms | |
| RSI(14) | 892 µs | WilliamsR(14) | 2.97 ms | |
| Stochastic(14,3) | 3.31 ms |
The transform from data space to pixel space is the hot path. A value becomes a pixel as the value less where
the range starts, times the pixels per unit, plus where the plot starts, each step rounded once and never fused,
so a point lands on the same bits whichever path draws it and on every processor, and a narrow range far from 0
(a millisecond of dates) keeps all its digits. An array of points is a single-pass AVX SIMD interleave: that rule
four points at a time, then UnpackLow/High, then Permute2x128, then a store via MemoryMarshal.Cast; off x86
it falls back to scalar code. It takes 343 ns for 1K points, 35 µs for 10K and 72 µs for 100K; one direction of
100K values takes 31 µs. Every line, scatter, area and bubble renderer uses this transform, so indicator output
benefits from it automatically.
| Benefit | Detail |
|---|---|
| Zero client cost | the page swaps in the new SVG markup — no canvas redraw, no layout recalculation |
| Inline SVG | part of the DOM: CSS-styleable, screen-reader accessible, prints as vector |
| Consistent | every client sees the same chart, no browser rendering differences |
| Bandwidth | a typical chart is 5–15 KB; a viewer that subscribes with SubscribeToParts is sent the whole SVG once and then only the parts that changed (one moved panel of seven: 14 % of the document), and nothing when nothing changed; a viewer that subscribes with Subscribe gets the whole SVG each time it changed |
| Lean | a figure drawn again draws only the axes that changed, its subplots one after another, and the document is copied once into its string |
The benchmark program models a server that redraws a dashboard and pushes every SVG: a trend fed a point every quarter second, a row of eleven stat tiles, seven stacked panels, four log-scale panels and a lit 3-D surface, each on its own cadence. 1.29.0 and 1.30.0 ran the same program (without the rows 1.29.0 cannot build) on the 9950X3D with .NET 10.0.15, back to back, six rounds with the order alternating, at below-normal priority; each figure is the mean of the six rounds, with the range in brackets. What counts is the CPU time of the process, not the clock.
| A round of the wall (eight beats and one of the slow parts) | 1.29.0 | 1.30.0 |
|---|---|---|
| CPU spent by the process | 22.8 ms (19.8–25.7) | 9.8 ms (9.5–9.9), −57 % |
| time on the clock | 16.9 ms | 7.0 ms |
| the SVG it writes, over 400 rounds | 922,809 KiB | 532,911 KiB, −42 % |
Turning a lit 3-D surface beside three panels, one degree a frame (CPU time of the process per frame):
| One frame | 1.29.0 | 1.30.0 |
|---|---|---|
| SVG | 5.05 ms (4.45–5.73) | 0.97 ms (0.94–1.02) |
| SVG with the Skia package loaded | 8.68 ms (8.44–9.58) | 1.06 ms (0.99–1.17) |
| in a WPF, Avalonia or Uno control (a Skia raster canvas) | 7.89 ms (7.81–7.97) | 4.97 ms (4.92–5.04) |
In 1.29.0 a control drew the whole figure through the renderer on every frame. In 1.30.0 it replays the panels from a recording and draws only the turned surface again; the surface's faces are most of what is left.
A figure built again for every draw pays its build every time. Building, without drawing, 1.29.0 against 1.30.0:
| Build | 1.29.0 | 1.30.0 | allocated 1.29.0 | allocated 1.30.0 |
|---|---|---|---|---|
| one line, a title, a label | 231 ns | 207 ns | 4.07 KB | 3.03 KB |
| a Pareto chart | 618 ns | 615 ns | 7.77 KB | 5.74 KB |
| a 3 x 3 grid of two lines each | 2.53 µs | 2.32 µs | 35.8 KB | 26.6 KB |
| the seven panels of the wall | 2.58 µs | 2.39 µs | 33.3 KB | 25.1 KB |
| the tile row of the wall | 3.06 µs | 3.04 µs | 49.2 KB | 40.0 KB |
| 10,000 vertical lines | 25.4 µs | 25.8 µs | 473.4 KB | 472.0 KB |
A new axes starts from one shared legend, grid, spines and tick settings instead of making its own, and the theme a style describes is made once per change of the style, not once per figure. The tile row and the 10,000 vertical lines build in the time they took in 1.29.0, within the spread of the rounds.
The figures per draw and what changed are in BENCHMARKS.md.
cd Benchmarks/MatPlotLibNet.Benchmarks
dotnet run -c Release -- --filter "*SvgRendering*"
dotnet run -c Release -- --filter "*Indicator*"
dotnet run -c Release -- --filter "*LiveWall*"
dotnet run -c Release -- --live-wall 60 # a live dashboard for a minute: what each part costs
dotnet run -c Release -- --live-wall-burst 400 # the same mix without pauses: the CPU time of the process
dotnet run -c Release -- --drag svg4 300 # a 3-D surface turned a degree a frame: CPU and allocation per frame
dotnet run -c Release -- --filter "*" # all suitesRun one suite at a time. Concurrent runs contend for the CPU and inflate the timings.
MatPlotLibNet 1.30.0
- Home
- Getting Started
- Fluent Cheatsheet
- Examples — each release in code
- Migrating to 1.30.0 — what was removed and what takes its place
-
Package Map
- MatPlotLibNet — the core package
- Chart Types
- Styling
- Advanced
- Streaming
- Bidirectional SignalR
- Interactive Controls
- MCP Server
- Verso
- Notebooks
- Accessibility
- International Text
- Benchmarks
- Roadmap
- Contributing
On the docs site
- Playground — try a chart in the browser
- Cookbook — copy-paste code with its picture
- API reference — every public type and member