Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/cost-models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ doc/cost-models/
## Data Sources

- **Benchmark Data**: `plutus-core/cost-model/data/benching-conway.csv`
- **Cost Models**: `plutus-core/cost-model/data/builtinCostModelC.json`
- **Cost Models**: `plutus-core/cost-model/data/builtinCostModelE.json`

Data is loaded dynamically from the Plutus repository using the browser's `fetch()` API.

Expand Down Expand Up @@ -164,7 +164,7 @@ No build process required - the workflow copies static files directly to `gh-pag

**Model not found:**

- Verify function name matches key in `builtinCostModelC.json`
- Verify function name matches key in `builtinCostModelE.json`
- Check console for detailed error messages

**Plot not rendering:**
Expand Down
15 changes: 13 additions & 2 deletions doc/cost-models/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<li><a href="listtoarray/index.html">ListToArray</a></li>
<li><a href="lengthofarray/index.html">LengthOfArray</a></li>
<li><a href="indexarray/index.html">IndexArray</a></li>
<li><a href="multiindexarray/index.html">MultiIndexArray</a></li>
<li><a href="indexbytestring/index.html">IndexByteString</a></li>
</ul>
</nav>
Expand Down Expand Up @@ -135,6 +136,16 @@ <h2>Available Visualizations</h2>
</p>
</li>

<li>
<a href="multiindexarray/index.html">MultiIndexArray</a>
<p class="description">
Looks up a list of indices in a Plutus array; linear in the number of indices,
independent of the array size.
(3D visualization: Haystack Size &times; Needles Size vs Time, plus per-index time
distribution histogram)
</p>
</li>

<li>
<a href="indexbytestring/index.html">IndexByteString</a>
<p class="description">
Expand All @@ -157,7 +168,7 @@ <h2>Data Sources</h2>
</li>
<li>
<strong>Cost Models:</strong>
<a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelC.json" target="_blank">builtinCostModelC.json</a>
<a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelE.json" target="_blank">builtinCostModelE.json</a>
</li>
</ul>
<p>
Expand Down Expand Up @@ -239,7 +250,7 @@ <h3>Troubleshooting</h3>
</li>
<li>
<strong>Model not found:</strong> Verify function name matches the key in
<code>builtinCostModelC.json</code>
<code>builtinCostModelE.json</code>
</li>
<li>
<strong>Plot not rendering:</strong> Check Plotly errors in console;
Expand Down
3 changes: 2 additions & 1 deletion doc/cost-models/indexarray/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<li><a href="../listtoarray/index.html">ListToArray</a></li>
<li><a href="../lengthofarray/index.html">LengthOfArray</a></li>
<li><a href="../indexarray/index.html" class="active">IndexArray</a></li>
<li><a href="../multiindexarray/index.html">MultiIndexArray</a></li>
<li><a href="../indexbytestring/index.html">IndexByteString</a></li>
</ul>
</nav>
Expand Down Expand Up @@ -118,7 +119,7 @@ <h3>Plot Information</h3>
<div class="info-section">
<dt>Data sources:</dt>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/benching-conway.csv" target="_blank">benching-conway.csv</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelC.json" target="_blank">builtinCostModelC.json</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelE.json" target="_blank">builtinCostModelE.json</a></dd>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/cost-models/indexarray/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function generateUrlFromBranch(branch) {
function getFileUrls(baseUrl) {
return {
csv: `${baseUrl}/benching-conway.csv`,
json: `${baseUrl}/builtinCostModelC.json`
json: `${baseUrl}/builtinCostModelE.json`
};
}

Expand Down
3 changes: 2 additions & 1 deletion doc/cost-models/indexbytestring/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<li><a href="../listtoarray/index.html">ListToArray</a></li>
<li><a href="../lengthofarray/index.html">LengthOfArray</a></li>
<li><a href="../indexarray/index.html">IndexArray</a></li>
<li><a href="../multiindexarray/index.html">MultiIndexArray</a></li>
<li><a href="../indexbytestring/index.html" class="active">IndexByteString</a></li>
</ul>
</nav>
Expand Down Expand Up @@ -121,7 +122,7 @@ <h3>Plot Information</h3>
<div class="info-section">
<dt>Data sources:</dt>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/benching-conway.csv" target="_blank">benching-conway.csv</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelC.json" target="_blank">builtinCostModelC.json</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelE.json" target="_blank">builtinCostModelE.json</a></dd>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/cost-models/indexbytestring/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function generateUrlFromBranch(branch) {
function getFileUrls(baseUrl) {
return {
csv: `${baseUrl}/benching-conway.csv`,
json: `${baseUrl}/builtinCostModelC.json`
json: `${baseUrl}/builtinCostModelE.json`
};
}

Expand Down
3 changes: 2 additions & 1 deletion doc/cost-models/insertcoin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<li><a href="../listtoarray/index.html">ListToArray</a></li>
<li><a href="../lengthofarray/index.html">LengthOfArray</a></li>
<li><a href="../indexarray/index.html">IndexArray</a></li>
<li><a href="../multiindexarray/index.html">MultiIndexArray</a></li>
<li><a href="../indexbytestring/index.html">IndexByteString</a></li>
</ul>
</nav>
Expand Down Expand Up @@ -111,7 +112,7 @@ <h3>Plot Information</h3>
<div class="info-section">
<dt>Data sources:</dt>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/benching-conway.csv" target="_blank">benching-conway.csv</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelC.json" target="_blank">builtinCostModelC.json</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelE.json" target="_blank">builtinCostModelE.json</a></dd>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/cost-models/insertcoin/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function generateUrlFromBranch(branch) {
function getFileUrls(baseUrl) {
return {
csv: `${baseUrl}/benching-conway.csv`,
json: `${baseUrl}/builtinCostModelC.json`
json: `${baseUrl}/builtinCostModelE.json`
};
}

Expand Down
3 changes: 2 additions & 1 deletion doc/cost-models/lengthofarray/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<li><a href="../listtoarray/index.html">ListToArray</a></li>
<li><a href="../lengthofarray/index.html" class="active">LengthOfArray</a></li>
<li><a href="../indexarray/index.html">IndexArray</a></li>
<li><a href="../multiindexarray/index.html">MultiIndexArray</a></li>
<li><a href="../indexbytestring/index.html">IndexByteString</a></li>
</ul>
</nav>
Expand Down Expand Up @@ -118,7 +119,7 @@ <h3>Plot Information</h3>
<div class="info-section">
<dt>Data sources:</dt>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/benching-conway.csv" target="_blank">benching-conway.csv</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelC.json" target="_blank">builtinCostModelC.json</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelE.json" target="_blank">builtinCostModelE.json</a></dd>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/cost-models/lengthofarray/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function generateUrlFromBranch(branch) {
function getFileUrls(baseUrl) {
return {
csv: `${baseUrl}/benching-conway.csv`,
json: `${baseUrl}/builtinCostModelC.json`
json: `${baseUrl}/builtinCostModelE.json`
};
}

Expand Down
3 changes: 2 additions & 1 deletion doc/cost-models/listtoarray/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<li><a href="../listtoarray/index.html" class="active">ListToArray</a></li>
<li><a href="../lengthofarray/index.html">LengthOfArray</a></li>
<li><a href="../indexarray/index.html">IndexArray</a></li>
<li><a href="../multiindexarray/index.html">MultiIndexArray</a></li>
<li><a href="../indexbytestring/index.html">IndexByteString</a></li>
</ul>
</nav>
Expand Down Expand Up @@ -118,7 +119,7 @@ <h3>Plot Information</h3>
<div class="info-section">
<dt>Data sources:</dt>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/benching-conway.csv" target="_blank">benching-conway.csv</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelC.json" target="_blank">builtinCostModelC.json</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelE.json" target="_blank">builtinCostModelE.json</a></dd>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/cost-models/listtoarray/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function generateUrlFromBranch(branch) {
function getFileUrls(baseUrl) {
return {
csv: `${baseUrl}/benching-conway.csv`,
json: `${baseUrl}/builtinCostModelC.json`
json: `${baseUrl}/builtinCostModelE.json`
};
}

Expand Down
3 changes: 2 additions & 1 deletion doc/cost-models/lookupcoin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<li><a href="../listtoarray/index.html">ListToArray</a></li>
<li><a href="../lengthofarray/index.html">LengthOfArray</a></li>
<li><a href="../indexarray/index.html">IndexArray</a></li>
<li><a href="../multiindexarray/index.html">MultiIndexArray</a></li>
<li><a href="../indexbytestring/index.html">IndexByteString</a></li>
</ul>
</nav>
Expand Down Expand Up @@ -118,7 +119,7 @@ <h3>Plot Information</h3>
<div class="info-section">
<dt>Data sources:</dt>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/benching-conway.csv" target="_blank">benching-conway.csv</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelC.json" target="_blank">builtinCostModelC.json</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelE.json" target="_blank">builtinCostModelE.json</a></dd>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/cost-models/lookupcoin/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function generateUrlFromBranch(branch) {
function getFileUrls(baseUrl) {
return {
csv: `${baseUrl}/benching-conway.csv`,
json: `${baseUrl}/builtinCostModelC.json`
json: `${baseUrl}/builtinCostModelE.json`
};
}

Expand Down
166 changes: 166 additions & 0 deletions doc/cost-models/multiindexarray/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MultiIndexArray - Plutus Cost Model Visualization</title>
<link rel="stylesheet" href="../shared/styles.css">
<script src="https://cdn.plot.ly/plotly-2.27.0.min.js"></script>
</head>
<body>
<nav>
<ul>
<li><a href="../index.html">Home</a></li>
<li><a href="../valuedata/index.html">ValueData</a></li>
<li><a href="../unvaluedata/index.html">UnValueData</a></li>
<li><a href="../valuecontains/index.html">ValueContains</a></li>
<li><a href="../lookupcoin/index.html">LookupCoin</a></li>
<li><a href="../insertcoin/index.html">InsertCoin</a></li>
<li><a href="../unionvalue/index.html">UnionValue</a></li>
<li><a href="../scalevalue/index.html">ScaleValue</a></li>
<li><a href="../listtoarray/index.html">ListToArray</a></li>
<li><a href="../lengthofarray/index.html">LengthOfArray</a></li>
<li><a href="../indexarray/index.html">IndexArray</a></li>
<li><a href="../multiindexarray/index.html" class="active">MultiIndexArray</a></li>
<li><a href="../indexbytestring/index.html">IndexByteString</a></li>
</ul>
</nav>

<div class="container">
<h1>MultiIndexArray Cost Model Visualization</h1>
<p>
Interactive visualization of benchmark data and fitted cost model for the <code>MultiIndexArray</code> builtin function.
This function looks up a list of indices (needles) in a Plutus array (haystack); the cost is linear in the
number of indices and independent of the array size, so the model plane in the 3D view is flat along the
haystack axis. The number of indices is limited, because beyond that limit the execution time is not
predictable from the index count alone; the histogram below shows the per-index time distribution.
</p>

<div class="controls" id="data-source-controls">
<h3 id="data-source-toggle">Data Source Configuration</h3>
<div class="controls-content">
<div class="control-group-vertical">
<label for="branch-name">Branch name:</label>
<div class="branch-input-row">
<input type="text" id="branch-name" placeholder="master">
<button id="copy-link" title="Copy shareable link">Copy Link</button>
</div>
</div>
<div class="control-group-vertical">
<label for="csv-url">CSV file URL:</label>
<input type="text" id="csv-url" style="width: 100%; font-family: monospace;">
</div>
<div class="control-group-vertical">
<label for="json-url">JSON file URL:</label>
<input type="text" id="json-url" style="width: 100%; font-family: monospace;">
</div>
<div class="control-group">
<button id="reload-data">Load Data</button>
</div>
</div>
</div>

<div class="controls" id="plot-controls">
<h3 id="plot-controls-toggle">Plot Controls</h3>
<div class="controls-content">
<div class="control-group">
<input type="checkbox" id="show-model" checked>
<label for="show-model">Show model predictions</label>
</div>
<div class="control-group">
<label for="z-axis-mode">Z-axis range:</label>
<select id="z-axis-mode">
<option value="zero">Start from 0</option>
<option value="auto">Auto-scale from min</option>
</select>
</div>
<div class="control-group">
<label for="hist-threshold">Histogram: min index count:</label>
<select id="hist-threshold">
<option value="1000">1000</option>
<option value="2000" selected>2000</option>
<option value="3000">3000</option>
</select>
</div>
</div>
</div>

<div class="plot-wrapper">
<div id="plot-container">
<div class="loading">Loading data and generating plot...</div>
</div>

<div class="info-panel">
<h3>Plot Information</h3>

<div class="info-section">
<dl>
<dt>X-axis:</dt>
<dd id="info-x-axis">Haystack size (array length, log scale)</dd>

<dt>Y-axis:</dt>
<dd id="info-y-axis">Needles size (length of the index list)</dd>

<dt>Z-axis:</dt>
<dd id="info-z-axis">Time (nanoseconds)</dd>

<dt>Description:</dt>
<dd id="info-description">Each point is one benchmark. The model plane is flat along the
haystack axis and slopes along the needles axis.</dd>
</dl>
</div>

<div class="info-section">
<dt>Cost Model Type:</dt>
<dd id="info-model-type">Loading...</dd>

<dt>Model Formula (net):</dt>
<dd class="formula" id="info-model-formula">Loading...</dd>

<dt>Overhead:</dt>
<dd id="info-overhead">Loading...</dd>
</div>

<div class="info-section">
<dl>
<dt>Data points:</dt>
<dd id="info-data-points">-</dd>

<dt>Index count range:</dt>
<dd id="info-x-range">-</dd>

<dt>Array size range:</dt>
<dd id="info-array-range">-</dd>

<dt>Time range:</dt>
<dd id="info-time-range">-</dd>
</dl>
</div>

<div class="info-section">
<dt>Data sources:</dt>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/benching-conway.csv" target="_blank">benching-conway.csv</a></dd>
<dd><a href="https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModelE.json" target="_blank">builtinCostModelE.json</a>
(PlutusV3 from PV&nbsp;11 / vanRossem)</dd>
</div>
</div>
</div>

<h2>Per-index time distribution</h2>
<p>
Net time per index, <code>(t &minus; overhead) / indexCount</code>, for benchmarks with at least the
selected number of indices. The dashed line marks the net slope of the fitted model.
</p>
<div id="hist-container">
<div class="loading">Loading...</div>
</div>
</div>

<footer>
<p>Plutus Cost Model Visualization | <a href="https://github.com/IntersectMBO/plutus" target="_blank">Plutus Repository</a></p>
</footer>

<script src="../shared/utils.js"></script>
<script src="plot.js"></script>
</body>
</html>
Loading
Loading