This website provides interactive visualizations of Plutus Core builtin function cost models. Each visualization displays benchmark data alongside fitted cost model predictions, allowing developers and stakeholders to understand the performance characteristics of builtin functions.
Cost models are critical for ensuring accurate script execution costs on the Cardano blockchain. These visualizations help verify that the mathematical models accurately represent the actual execution time measured during benchmarking.
All visualizations load data directly from the official Plutus repository:
Data is fetched dynamically using the browser's fetch() API, ensuring you always see
the latest benchmarks and cost models from the master branch.
Developers can easily add visualizations for additional builtin functions by following these steps:
cp -r valuedata/ myfunction/
myfunction/index.html:
PAGES in shared/utils.js:
['myfunction', 'MyFunction', 'What it does. (2D visualization: ...)']
This is what puts the page in the navigation bar and in the list above.
myfunction/plot.js:
FUNCTION_NAME constant (must match CSV entry exactly)ARITY constant (number of arguments for overhead calculation)renderPlot() functionpython -m http.server 8000
# Visit http://localhost:8000/myfunction/
index.html to include your function in the listbuiltinCostModelE.json
shared/utils.js
For a 2D plot with a single argument:
const FUNCTION_NAME = 'MyFunction'; // Must match CSV
const ARITY = 1; // Number of arguments
// In renderPlot():
const benchmarkX = benchmarkData.map(d => d.args[0]); // First argument
const benchmarkY = benchmarkData.map(d => d.time); // Time (always Y)
For a 3D plot with two arguments:
const FUNCTION_NAME = 'MyFunction';
const ARITY = 2;
// In renderPlot():
const benchmarkX = benchmarkData.map(d => d.args[0]); // First argument
const benchmarkY = benchmarkData.map(d => d.args[1]); // Second argument
const benchmarkZ = benchmarkData.map(d => d.time); // Time (always Z)
This is a static website built with plain HTML, CSS, and JavaScript. It uses Plotly.js for interactive plotting. No build tools or frameworks are required.
The website implements JavaScript evaluators for various cost model types (linear, quadratic, multi-dimensional, etc.). Model predictions are calculated at the same input points as the benchmark data to enable direct comparison.
Overhead values are automatically calculated from Nop benchmarks in the CSV file.
The overhead for a given arity is added to all model predictions to account for the base cost
of function invocation and result handling.
This site can be deployed to GitHub Pages or any static hosting service. Opening
index.html from disk works as well, because the data is fetched from GitHub
over HTTPS. A local HTTP server is only needed to plot data files that are not on GitHub
yet, since fetch() rejects file:// URLs:
python3 -m http.server 8000