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.
47 lines
991 B
Text
47 lines
991 B
Text
# Generated by Cargo
|
|
# will have compiled files and executables
|
|
**/*/target/
|
|
target
|
|
|
|
# ABI JSON and storage slots JSON output files in tests
|
|
**/*/json_abi_output*.json
|
|
**/*/json_abi_output_flat.json
|
|
**/*/json_storage_slots_output*.json
|
|
|
|
# Performance benchmark outputs
|
|
**/*/*gas-usages-*.csv
|
|
**/*/*gas-usages-*.md
|
|
**/*/*gas-usages-*.html
|
|
**/*/*bytecode-sizes-*.csv
|
|
**/*/*bytecode-sizes-*.md
|
|
**/*/*bytecode-sizes-*.html
|
|
|
|
# These are backup files generated by rustfmt
|
|
**/*.rs.bk
|
|
|
|
# `std` is a lib, no need to commit its lock file.
|
|
sway-lib-std/Forc.lock
|
|
|
|
# Forc's build directory
|
|
out
|
|
|
|
# Benchmarks data output directory
|
|
benchmarks/
|
|
|
|
# Generated client schema
|
|
**/schema.graphql
|
|
|
|
# .DS_Store
|
|
.DS_Store
|
|
|
|
# Generated files in test directories
|
|
sway-lsp/tests/**/Forc.lock
|
|
forc-plugins/forc-debug/tests/**/Forc.lock
|
|
forc-plugins/forc-client/test/**/Forc.lock
|
|
|
|
# Generated files in example directories
|
|
examples/**/*/Forc.lock
|
|
docs/reference/src/code/examples/**/*/Forc.lock
|
|
|
|
# Insta files
|
|
*.snap.new
|