Skip to content
Merged
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
1 change: 1 addition & 0 deletions doc/cost-models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Then open your browser to:
- **UnValueData** - Converts Data back to Value (2D plot)
- **ValueContains** - Checks if one Value contains another (3D plot)
- **LookupCoin** - Looks up a coin in a Value (2D plot)
- **IndexByteString** - Retrieves a byte at a given index from a ByteString (2D plot)

## Project Structure

Expand Down
9 changes: 9 additions & 0 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="indexbytestring/index.html">IndexByteString</a></li>
</ul>
</nav>

Expand Down Expand Up @@ -133,6 +134,14 @@ <h2>Available Visualizations</h2>
(2D visualization: Array Size vs Time - constant cost)
</p>
</li>

<li>
<a href="indexbytestring/index.html">IndexByteString</a>
<p class="description">
Retrieves a byte at a given index from a ByteString in O(1) time. Performs a bounds check and returns the byte value (Word8).
(2D visualization: ByteString Size vs Time - constant cost)
</p>
</li>
</ul>
</section>

Expand Down
1 change: 1 addition & 0 deletions 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="../indexbytestring/index.html">IndexByteString</a></li>
</ul>
</nav>

Expand Down
137 changes: 137 additions & 0 deletions doc/cost-models/indexbytestring/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IndexByteString - 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="../indexbytestring/index.html" class="active">IndexByteString</a></li>
</ul>
</nav>

<div class="container">
<h1>IndexByteString Cost Model Visualization</h1>
<p>
Interactive visualization of benchmark data and fitted cost model for the <code>IndexByteString</code> builtin function.
Retrieves a byte at a given index from a ByteString in O(1) time. Performs a bounds check and returns the byte value (Word8).
</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="y-axis-mode">Y-axis range:</label>
<select id="y-axis-mode">
<option value="zero">Start from 0</option>
<option value="auto">Auto-scale from min</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">ByteString Size (bytes)</dd>

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

<dt>Description:</dt>
<dd id="info-description">Each point represents one benchmark run (constant time regardless of ByteString size or index)</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>ByteString Size range:</dt>
<dd id="info-x-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/builtinCostModelC.json" target="_blank">builtinCostModelC.json</a></dd>
</div>
</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