Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8787fa1
optimisations running on loop
xunilrj Jun 5, 2026
12b4f14
compat script to macos
xunilrj Jun 5, 2026
30b08f6
update tests
xunilrj Jun 5, 2026
a94b693
update tests
xunilrj Jun 5, 2026
2cc37fc
update tests
xunilrj Jun 5, 2026
a73c86f
avoid infinite loop on local_copy_prop
xunilrj Jun 5, 2026
fdf27b2
fix justfile
xunilrj Jun 5, 2026
3de9fb4
fmt and clippy issues
xunilrj Jun 5, 2026
3bd8299
new inline threshold
xunilrj Jun 8, 2026
6e186be
do not inline with asm blocks
xunilrj Jun 8, 2026
88a146c
increase inlining threshold on call sites inside loops
xunilrj Jun 10, 2026
cd6b626
increase inlining threshold on call sites inside loops
xunilrj Jun 10, 2026
014d9a8
fmt and clippy issues
xunilrj Jun 10, 2026
2c082a4
update tests
xunilrj Jun 10, 2026
b4cdcf2
update tests
xunilrj Jun 10, 2026
7e62d56
fix justfile for mac
xunilrj Jun 10, 2026
44ec2c6
do not inline fns with asm blocks
xunilrj Jun 10, 2026
7ceb66a
new inline threshold
xunilrj Jun 10, 2026
48dd11e
new inline threshold
xunilrj Jun 10, 2026
9ebcea8
new inline threshold
xunilrj Jun 10, 2026
b39d1d3
new inline threshold
xunilrj Jun 10, 2026
02a3836
new inline threshold
xunilrj Jun 10, 2026
28fb3ab
new inline threshold
xunilrj Jun 10, 2026
ab552ee
finishing up PR
xunilrj Jun 10, 2026
8b37c5d
fmt and clippy issues
xunilrj Jun 10, 2026
a53b41c
update tests
xunilrj Jun 11, 2026
d92fdbb
update tests
xunilrj Jun 11, 2026
0994dc4
fix typo
xunilrj Jun 11, 2026
1e47222
update tests
xunilrj Jun 11, 2026
4f887f4
update tests
xunilrj Jun 11, 2026
81c16c4
update tests
xunilrj Jun 11, 2026
7196d95
fix ir test harness
xunilrj Jun 12, 2026
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 Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions forc-test/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ impl TestExecutor {
.add_unsigned_coin_input(secret_key, utxo_id, amount, asset_id, tx_pointer)
.maturity(maturity);

let mut output_index = 1;
// Insert contract ids into tx input
for contract_id in test_setup.contract_ids() {
for (output_index, contract_id) in (1..).zip(test_setup.contract_ids()) {
tx_builder
.add_input(tx::Input::contract(
tx::UtxoId::new(tx::Bytes32::zeroed(), 0),
Expand All @@ -101,7 +100,6 @@ impl TestExecutor {
balance_root: fuel_tx::Bytes32::zeroed(),
state_root: tx::Bytes32::zeroed(),
}));
output_index += 1;
}

let consensus_params = tx_builder.get_params().clone();
Expand Down
8 changes: 4 additions & 4 deletions forc/tests/cli_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ fn test_forc_test_raw_logs() -> Result<(), rexpect::error::Error> {
// Assert that the output is correct
process.exp_string(" test test_log_4")?;
process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11280,"ptr":12456,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11288,"ptr":12464,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(" test test_log_2")?;
process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11280,"ptr":12456,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11288,"ptr":12464,"ra":0,"rb":1515152261580153489}}]"#)?;

process.process.exit()?;
Ok(())
Expand All @@ -77,12 +77,12 @@ fn test_forc_test_both_logs() -> Result<(), rexpect::error::Error> {
process.exp_string("decoded log values:")?;
process.exp_string("4, log rb: 1515152261580153489")?;
process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11280,"ptr":12456,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11288,"ptr":12464,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(" test test_log_2")?;
process.exp_string("decoded log values:")?;
process.exp_string("2, log rb: 1515152261580153489")?;
process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11280,"ptr":12456,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11288,"ptr":12464,"ra":0,"rb":1515152261580153489}}]"#)?;
process.process.exit()?;
Ok(())
}
23 changes: 22 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@ benchmark-tests:
# The `performance` group contains recipes related to benchmarking the performance of compiled code:
# gas usages and bytecode sizes.

CURRENT_BRANCH := `git branch --show-current`

pe2e-against-master:
echo "Performance: {{CURRENT_BRANCH}} vs master"
git clean -xfd test/perf_out
git checkout master
cargo r -p test --release -- XX # update reduced std-libs
just pa
git checkout {{CURRENT_BRANCH}}
cargo r -p test --release -- XX # update reduced std-libs
just pa
just pdl
echo "performance reports at ./test/perf_out"

pe2e-o2-against-master:
echo "Performance: {{CURRENT_BRANCH}} vs master"
git checkout master
cd ../sway-program-collection && git clean -xfd && just a
git checkout {{CURRENT_BRANCH}}
cd ../sway-program-collection && just a && just opd

alias pe2e := perf-e2e
# collect gas usages and bytecode sizes from E2E tests
[group('performance')]
Expand Down Expand Up @@ -96,7 +117,7 @@ perf-diff-latest format='md':
# format: output format, either `csv` or `html` (default: `csv`)
# open: for `html` output, `-o` opens the report in the default browser

alias psh := perf-snapshot-historical
#alias psh := perf-snapshot-historical
# collect historic gas usages from a snapshot test that has a `forc test` output
[linux]
[macos]
Expand Down
20 changes: 17 additions & 3 deletions scripts/perf/perf-diff-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ perf_diff_stats_script="./scripts/perf/perf-diff-stats.sh"

categories=("e2e-gas-usages" "e2e-bytecode-sizes" "in-language-gas-usages" "in-language-bytecode-sizes")


# macOS compatibility: gfind from `brew install findutils`
if [ -x "$(command -v gfind)" ]; then
find="gfind"
else
find="find"
fi

err() {
echo "ERROR: $*" >&2
exit 1
Expand All @@ -28,8 +36,11 @@ process_category() {
local category="$1"

# Collect candidates: "*-<category>-*.csv", but skip "-<category>-historical-*.csv".
mapfile -t candidates < <(
find "$perf_out_dir" -maxdepth 1 -type f -name "*-${category}-*.csv" -printf "%p\n" 2>/dev/null |
candidates=()
while IFS= read -r line; do
candidates+=("$line")
done < <(
$find "$perf_out_dir" -maxdepth 1 -type f -name "*-${category}-*.csv" -printf "%p\n" 2>/dev/null |
while IFS= read -r f; do
base="$(basename -- "$f")"

Expand All @@ -50,7 +61,10 @@ process_category() {
fi

# Sort by timestamp (asc) and take last two paths.
mapfile -t sorted_paths < <(
sorted_paths=()
while IFS= read -r line; do
sorted_paths+=("$line")
done < <(
printf "%s\n" "${candidates[@]}" |
sort -n -k1,1 |
awk -F'\t' '{print $2}' |
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/asm_generation/fuel/fuel_asm_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2330,7 +2330,7 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> {
// XXX not required after we have FuelVM specific verifier.
if !val
.get_type(self.context)
.and_then(|val_ty| key.get_type(self.context).map(|key_ty| (val_ty, key_ty)))
.zip(key.get_type(self.context))
.is_some_and(|(val_ty, key_ty)| {
val_ty.is_ptr(self.context) && key_ty.is_ptr(self.context)
})
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/ir_generation/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ pub(super) fn convert_resolved_type_info(
elem_type.type_id,
span,
)?;
Type::new_array(context, elem_type, len as u64)
Type::new_array(context, elem_type, len)
}

TypeInfo::Tuple(fields) => {
Expand Down
1 change: 1 addition & 0 deletions sway-ir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sway-types.workspace = true
sway-utils.workspace = true

[dev-dependencies]
expect-test.workspace = true
insta.workspace = true
vte.workspace = true

Expand Down
2 changes: 2 additions & 0 deletions sway-ir/src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ pub mod dominator;
pub use dominator::*;
pub mod memory_utils;
pub use memory_utils::*;
pub mod loop_analysis;
pub use loop_analysis::*;
Loading
Loading