Skip to content

Commit 0a75453

Browse files
authored
perf improve (#367)
* retire traces * compact ticket attempt * change L config in tiny * data decode and slice * cache trap * avoid runtime private(set) check * cache ring context * add decode lenghth check * improve ring context * avoid overflow * add checks * improve benchmark ci * update benchmark ci * ignore benchmark files * revert ticket changes (test vector not updated yet) * fix ring context
1 parent c6507b6 commit 0a75453

File tree

21 files changed

+175
-2072
lines changed

21 files changed

+175
-2072
lines changed

.github/workflows/benchmark-pr.yml

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ on:
55
pull_request:
66
branches: [ master ]
77

8-
concurrency:
9-
group: ${{ github.workflow }}-${{ github.ref }}
10-
cancel-in-progress: true
11-
128
env:
139
BENCHMARK_DISABLE_JEMALLOC: true
1410

@@ -124,35 +120,18 @@ jobs:
124120
125121
- name: Compare PR and master
126122
if: ${{ env.hasBenchmark == '1' }}
127-
id: benchmark
128123
run: |
129124
cd JAMTests
130-
echo "# 📊 Benchmark Results"
131-
echo "Generated on: $(date)"
132-
echo ""
133-
echo "exitStatus=1" >> $GITHUB_ENV
125+
echo "# 📊 Benchmark Results" >> $GITHUB_STEP_SUMMARY
126+
echo "Generated on: $(date)" >> $GITHUB_STEP_SUMMARY
127+
echo "" >> $GITHUB_STEP_SUMMARY
134128
135-
# Check if master baseline exists for comparison
136129
if [ -f ".benchmarkBaselines/BenchmarkTestVectors/master/results.json" ]; then
137-
echo "## 🔄 Comparison with Master Branch"
138-
echo ""
139-
swift package benchmark baseline check master pull_request --format markdown
140-
echo "exitStatus=0" >> $GITHUB_ENV
130+
swift package benchmark baseline compare master pull_request --no-progress --format markdown >> $GITHUB_STEP_SUMMARY 2>&1 || true
131+
echo "" >> $GITHUB_STEP_SUMMARY
132+
echo "## Threshold Check" >> $GITHUB_STEP_SUMMARY
133+
swift package benchmark baseline check master pull_request --format markdown >> $GITHUB_STEP_SUMMARY 2>&1 || true
141134
else
142-
echo "## 🆕 First Benchmark Run"
143-
echo ""
144-
echo "⚠️ Master baseline not found. This appears to be the first benchmark run."
145-
echo "The following results will become the baseline for future comparisons:"
146-
echo ""
147-
148-
# Run benchmarks to generate results for first time
149-
echo "### Benchmark Results:"
150-
swift package benchmark --format markdown 2>&1 || true
151-
echo "exitStatus=0" >> $GITHUB_ENV
135+
echo "⚠️ Master baseline not found. Running benchmarks for this PR:" >> $GITHUB_STEP_SUMMARY
136+
swift package benchmark --format markdown >> $GITHUB_STEP_SUMMARY 2>&1 || true
152137
fi
153-
continue-on-error: true
154-
155-
- name: Exit with correct status
156-
if: ${{ env.hasBenchmark == '1' }}
157-
run: |
158-
exit ${{ env.exitStatus }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ Tools/openrpc.json
3030
tmp
3131

3232
*.pvm
33+
34+
.benchmarkBaselines

Blockchain/Sources/Blockchain/Config/ProtocolConfig+Preset.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ extension Ref where T == ProtocolConfig {
121121
maxWorkItems: 16,
122122
maxDepsInWorkReport: 8,
123123
maxTicketsPerExtrinsic: 3,
124-
maxLookupAnchorAge: 14400,
124+
maxLookupAnchorAge: 24,
125125
transferMemoSize: 128,
126126
ticketEntriesPerValidator: 3,
127127
maxAuthorizationsPoolItems: 8,

Codec/Sources/Codec/IntegerCodec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extension Collection<UInt8> where SubSequence == Self {
1212
IntegerCodec.decode { self.next() }
1313
}
1414

15+
// NOTE: for data, use decodeUInt* methods in Data+Utils.swift for better performance
1516
public mutating func decode<T: UnsignedInteger>(length: Int) -> T? {
1617
guard length > 0, length <= count else { return nil }
1718

-1.24 MB
Binary file not shown.

JAMTests/fuzz/0.7.0/1756548916/00000081.json

Lines changed: 0 additions & 748 deletions
This file was deleted.
-1.24 MB
Binary file not shown.

JAMTests/fuzz/0.7.0/1756548916/00000082.json

Lines changed: 0 additions & 746 deletions
This file was deleted.
-348 KB
Binary file not shown.

JAMTests/fuzz/0.7.0/1757063641/00000179.json

Lines changed: 0 additions & 205 deletions
This file was deleted.

0 commit comments

Comments
 (0)