Skip to content

Latest commit

 

History

History
74 lines (63 loc) · 4.91 KB

pipeline.md

File metadata and controls

74 lines (63 loc) · 4.91 KB

Compile-Eval-Render Pipeline

Summary of the render process that happens on every tick (pan/zoom) in the graph.

Compile-Eval-Render pipeline for intervals

Let's assume we call functionPlot with the following configuration (note that graphType: 'interval' is the default):

functionPlot({
  target: '#playground',
  data: [
    { fn: 'x^2' }
  ]
})

There are multiple compute heavy steps that happen in the rendering pipeline:

{
  "target": "#playground",
  "data": [
    {
      "fn": "x^2",
      "interval_Expression_fn": "x^2",
      "interval_Compiled_fn": {
        "code": "return $$mathCodegen.functionProxy($$mathCodegen.getProperty(\"pow\", scope, ns), \"pow\")($$mathCodegen.getProperty(\"x\", scope, ns), ns.factory(2))",
        "eval": function(scope) {
          scope = scope || {};
          $$processScope(scope);
          return $$mathCodegen.functionProxy(
            $$mathCodegen.getProperty("pow", scope, ns), "pow")($$mathCodegen.getProperty("x", scope, ns), ns.factory(2)
          )
        }
      },
    }
  ]
}

Perf stats

Using npm run perf:pipeline for fn: 1/x:

┌─────────┬───────────────────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │           Task Name           │ ops/sec │ Average Time (ns)  │  Margin  │ Samples │
├─────────┼───────────────────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│    0    │    'compile and eval 1000'    │ '1,002' │ 997696.8855496896  │ '±4.88%' │   502   │
│    1    │ 'async compile and eval 1000' │ '2,300' │ 434699.05905056576 │ '±3.51%' │  1151   │
└─────────┴───────────────────────────────┴─────────┴────────────────────┴──────────┴─────────┘
┌─────────┬─────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │    Task Name    │ ops/sec │ Average Time (ns)  │  Margin  │ Samples │
├─────────┼─────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│    0    │ 'drawPath 1000' │ '8,375' │ 119393.74110532468 │ '±1.32%' │  4188   │
└─────────┴─────────────────┴─────────┴────────────────────┴──────────┴─────────┘