mirror of
https://github.com/FuelLabs/sway.git
synced 2025-12-23 10:11:56 +00:00
Some checks are pending
CI / build-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
CI / check-sdk-harness-test-suite-compatibility (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (push) Waiting to run
CI / cargo-run-e2e-test (push) Blocked by required conditions
CI / cargo-test-lib-std (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
Codspeed Benchmarks / benchmarks (push) Waiting to run
CI / verifications-complete (push) Blocked by required conditions
CI / check-dependency-version-formats (push) Waiting to run
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / build-mdbook (push) Waiting to run
CI / build-forc-doc-sway-lib-std (push) Waiting to run
CI / build-forc-test-project (push) Waiting to run
CI / cargo-build-workspace (push) Waiting to run
CI / cargo-clippy (push) Waiting to run
CI / cargo-run-e2e-test-release (push) Blocked by required conditions
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
CI / cargo-unused-deps-check (push) Waiting to run
CI / notify-slack-on-failure (push) Blocked by required conditions
CI / pre-publish-check (push) Waiting to run
CI / publish (push) Blocked by required conditions
CI / publish-sway-lib-std (push) Blocked by required conditions
CI / Build and upload forc binaries to release (push) Blocked by required conditions
github pages / deploy (push) Waiting to run
## Description This PR: - Adds `--perf` and `--perf-only` options to `test` to collect gas usages and bytecode sizes, and to run only the tests that actually produce those performance data, respectively. - Adds `[performance]` recipes to `justfile` that fully automate a workflow for collecting and comparing performance data of the compiler output. `--perf` flag instructs `test` to collect performance data from tests of categories `compile`, `run`, and `unit_tests_pass`. Collected gas usages and bytecode sizes are written to files named `<timestamp>-<category>-<build profile>-<branch>.csv`. E.g.: `1020165605-e2e-bytecode-sizes-release-master.csv`. When running tests in parallel (default option), performance data of each individual `test --exact <test_toml_path>` process is written to a piped stdout in JSON format. The main `test` process collects those JSON outputs from all spanned processes. The usual workflow of collecting and comparing performance data between the `master` and feature branch is supported by the following `just` recipes: ```console [performance] perf-e2e filter='' # collect gas usages and bytecode sizes from E2E tests [alias: pe2e] perf-in-lang filter='' # collect gas usages from in-language tests [alias: pil] perf-all filter='' # collect gas usages and bytecode sizes from all tests (E2E and in-language) [alias: pa] perf-diff before after format='md' # generate performance diff between two CSV files [alias: pd] perf-diff-latest format='md' # generate performance diffs between the latest two CSV files per testing category [alias: pdl] perf-snapshot-historical path open='' # collect historic gas usages from a snapshot test that has a `forc test` output [alias: psh] perf-list # list all performance files (*gas-usages-*.* and *bytecode-sizes-*.*) [alias: pl] perf-remove # remove all performance files (*gas-usages-*.* and *bytecode-sizes-*.*) [alias: pr] ``` To obtain the performance comparison it is enough to run: ```console just pa // `just perf-all`. On `master` to get the baseline. just pa // `just perf-all`. On the feature branch to get the improved data. just pdl // `just perf-diff-latest`. To get the diff of the last two collected performance data sets. ``` The `just` recipes should be executed from the root of the Sway repository. Aside from `--perf` writing to predefined files, all other parts of the workflow are `just` recipes and can potentially be tailored to any other workflow. Adding support for collecting gas usages and bytecode sizes from other tests like (snapshot, in-language, SDK harness) will be added in follow up PRs. ## Checklist - [ ] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
60 lines
2.6 KiB
Bash
Executable file
60 lines
2.6 KiB
Bash
Executable file
#!/bin/bash
|
|
echo '<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Pivot</title>
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/pivot.min.css">
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/pivot.min.js"></script>
|
|
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/d3_renderers.min.js"></script>
|
|
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.min.js"></script>
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/c3_renderers.min.js"></script>
|
|
|
|
<script src="https://cdn.plot.ly/plotly-basic-latest.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/plotly_renderers.min.js"></script>
|
|
|
|
<style>
|
|
body {font-family: Verdana;}
|
|
.node {
|
|
border: solid 1px white;
|
|
font: 10px sans-serif;
|
|
line-height: 12px;
|
|
overflow: hidden;
|
|
position: absolute;
|
|
text-indent: 2px;
|
|
}
|
|
</style>
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript">
|
|
$(function(){
|
|
var renderers = $.extend(
|
|
$.pivotUtilities.renderers,
|
|
$.pivotUtilities.c3_renderers,
|
|
$.pivotUtilities.d3_renderers,
|
|
$.pivotUtilities.plotly_renderers
|
|
);
|
|
$("#output").pivotUI($("table"), {
|
|
renderers,
|
|
rendererName: "Line Chart",
|
|
});
|
|
});
|
|
</script>
|
|
<div id="output" style="margin: 30px;"></div>
|
|
<br />
|
|
<table>
|
|
<thead>'
|
|
head -n 1 "$1" | sed -e 's/^/<tr><th>/' -e 's/,/<\/th><th>/g' -e 's/$/<\/th><\/tr>/'
|
|
echo ' </thead>
|
|
<tbody>'
|
|
tail -n +2 "$1" | sed -e 's/^/<tr><td>/' -e 's/,/<\/td><td>/g' -e 's/$/<\/td><\/tr>/'
|
|
echo " </tbody>
|
|
</table>
|
|
<body>
|
|
</html>"
|