-
Notifications
You must be signed in to change notification settings - Fork 9
perf: improve rust verifier memory usage #767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
06b4acc
d98b6bf
61b0e47
8789a20
8926c0c
3adcd3f
393e4d5
25a48bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Rust event verifier benchmark | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| paths: | ||
| - packages/ndk/lib/data_layer/repositories/verifiers/rust_event_verifier_native.dart | ||
| - packages/ndk/lib/src/rust_lib.dart | ||
| - packages/ndk/rust/** | ||
| - packages/ndk/tool/benchmark_rust_event_verifier.dart | ||
| - .github/workflows/rust-event-verifier-benchmark.yml | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| concurrency: | ||
| group: rust-event-verifier-benchmark-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| benchmark: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: packages/ndk | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Flutter | ||
| uses: subosito/flutter-action@v2 | ||
| with: | ||
| flutter-version: ${{ env.FLUTTER_VERSION }} | ||
| channel: stable | ||
| architecture: ${{ matrix.architecture }} | ||
| cache: true | ||
|
|
||
| - name: Install dependencies | ||
| run: dart pub get | ||
|
|
||
| - name: Run benchmark | ||
| run: dart run tool/benchmark_rust_event_verifier.dart > benchmark-results.json | ||
|
|
||
| - name: Record and compare benchmark | ||
| uses: benchmark-action/github-action-benchmark@v1 | ||
| with: | ||
| name: Rust event verifier | ||
| tool: customSmallerIsBetter | ||
| output-file-path: packages/ndk/benchmark-results.json | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| gh-pages-branch: benchmark-data | ||
| benchmark-data-dir-path: rust-event-verifier | ||
| auto-push: ${{ github.event_name == 'push' }} | ||
| save-data-file: ${{ github.event_name == 'push' }} | ||
| alert-threshold: 110% | ||
| comment-on-alert: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }} | ||
| summary-always: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| bool isNativeLibraryLoadError(ArgumentError error) { | ||
| final message = error.toString().toLowerCase(); | ||
| return message.contains('dynamic library') || | ||
| message.contains('failed to lookup symbol') || | ||
| message.contains("couldn't resolve native function") || | ||
| message.contains('no available native assets') || | ||
| message.contains('failed to load'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- target file ---'
cat -n packages/ndk/lib/src/cli/native_library_errors.dart
printf '%s\n' '--- classifier references ---'
rg -n -C 6 'nativeLibrary|NativeLibrary|failed to load|native_library_errors' packages/ndk/lib packages/ndk/test 2>/dev/null || true
printf '%s\n' '--- fallback caller context ---'
rg -n -C 12 'fallback|ArgumentError|native library|native_library' packages/ndk/lib/src/cli/ndk_cli_app.dart 2>/dev/null || trueRepository: relaystr/ndk Length of output: 7147 🤖 get_repo_knowledge executed:
Length of output: 2474 Narrow the generic
🤖 Prompt for AI Agents |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: relaystr/ndk
Length of output: 623
🤖 get_repo_knowledge executed:
get_repo_knowledge relaystr/ndk /tmp/coderabbit-repo-knowledge/relaystr-ndk-7f019aeb/learnings /tmp/coderabbit-repo-knowledge/relaystr-ndk-7f019aeb/conventionsLength of output: 4285
🏁 Script executed:
Repository: relaystr/ndk
Length of output: 22977
Define the workflow contexts used by the benchmark job.
The job defines neither
env.FLUTTER_VERSIONnorstrategy.matrix. The Flutter action receives no configured version, andactionlintrejectsmatrix.architectureas undefined. DefineFLUTTER_VERSIONand removearchitecture, or add a matching matrix strategy.🤖 Prompt for AI Agents
Source: Linters/SAST tools