-
-
Notifications
You must be signed in to change notification settings - Fork 257
Measure Dart SDK size overhead #2482
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f497ca3
simple dart app with sentry metrics
denrase cc84f26
change naming
denrase c600113
use action-app-sdk-overhead-metrics for console app
denrase 7f8b13f
revert for now
denrase b16ca72
Merge branch 'main' into ci/dart-only-metrics
denrase 1de8eaa
Merge branch 'main' into ci/dart-only-metrics
denrase 4726039
build on ubuntu
denrase eac1c90
Merge branch 'main' into ci/dart-only-metrics
denrase b3a89d1
fix code for ubuntu runner
denrase File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,3 +91,25 @@ jobs: | |
config: ./metrics/metrics-${{ matrix.platform }}.yml | ||
sauce-user: ${{ secrets.SAUCE_USERNAME }} | ||
sauce-key: ${{ secrets.SAUCE_ACCESS_KEY }} | ||
|
||
metrics-dart: | ||
name: Console | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # [email protected] | ||
|
||
- name: create dart sample apps | ||
working-directory: ./metrics | ||
run: ./prepare-dart.sh | ||
|
||
- name: build dart sample apps | ||
working-directory: ./metrics | ||
run: ./build-dart.sh | ||
|
||
- name: Set file diff max threshold | ||
run: echo "THRESHOLD=13100000" >> $GITHUB_ENV # 1,31 MB | ||
|
||
- name: Compare executable size | ||
working-directory: ./metrics | ||
run: ./compare_sizes.sh perf_test_console_plain.bin perf_test_console_sentry.bin $THRESHOLD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
perf-test-app* | ||
perf_test_console* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
cd perf_test_console_plain | ||
dart pub get | ||
cd .. | ||
dart compile exe perf_test_console_plain/bin/perf_test_console_plain.dart -o ./perf_test_console_plain.bin | ||
|
||
cd perf_test_console_sentry | ||
dart pub get | ||
cd .. | ||
dart compile exe perf_test_console_sentry/bin/perf_test_console_sentry.dart -o ./perf_test_console_sentry.bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Inputs: file1, file2, threshold | ||
FILE1=$1 | ||
FILE2=$2 | ||
THRESHOLD=$3 | ||
|
||
if [ ! -f "$FILE1" ]; then | ||
echo "File not found: $FILE1" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f "$FILE2" ]; then | ||
echo "File not found: $FILE2" | ||
exit 1 | ||
fi | ||
|
||
# Get sizes of files (macOS-specific) | ||
SIZE1=$(stat -f%z "$FILE1") | ||
SIZE2=$(stat -f%z "$FILE2") | ||
|
||
# Calculate absolute size difference | ||
SIZE_DIFF=$(( SIZE1 - SIZE2 )) | ||
SIZE_DIFF=${SIZE_DIFF#-} # Convert to absolute value | ||
|
||
# Print results | ||
echo "File 1: $FILE1 (Size: $SIZE1 bytes)" | ||
echo "Binary 2: $FILE2 (Size: $SIZE2 bytes)" | ||
echo "Difference: $SIZE_DIFF bytes" | ||
|
||
# Check if the size difference exceeds the threshold | ||
if [ "$SIZE_DIFF" -gt "$THRESHOLD" ]; then | ||
echo "ERROR: Size difference between $FILE1 and $FILE2 exceeds $THRESHOLD bytes!" | ||
exit 1 | ||
else | ||
echo "SUCCESS: Size difference between $FILE1 and $FILE2 is within $THRESHOLD bytes." | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
targetDir=$( | ||
cd $(dirname $0) | ||
pwd | ||
) | ||
[[ "$targetDir" != "" ]] || exit 1 | ||
|
||
dartCreate() { | ||
name=${1//-/_} | ||
dir=$targetDir/$1 | ||
rm -rf $dir | ||
echo "::group::dart create $1" | ||
dart create -t console $name | ||
echo '::endgroup::' | ||
} | ||
|
||
dartCreate 'perf_test_console_plain' | ||
dartCreate 'perf_test_console_sentry' | ||
|
||
echo '::group::Patch perf_test_console_sentry' | ||
pubspec="$targetDir/perf_test_console_sentry/pubspec_overrides.yaml" | ||
echo "Adding dependencies to $pubspec" | ||
cat <<EOF >>"$pubspec" | ||
|
||
dependency_overrides: | ||
sentry: | ||
path: ../../dart | ||
|
||
EOF | ||
|
||
fileToReplace="$targetDir/perf_test_console_sentry/bin/perf_test_console_sentry.dart" | ||
if [[ -f "$fileToReplace" ]]; then | ||
echo "Replacing $fileToReplace with new content" | ||
cat <<'NEW_FILE_CONTENT' >"$fileToReplace" | ||
import 'package:perf_test_console_sentry/perf_test_console_sentry.dart' as perf_test_console_sentry; | ||
import 'package:sentry/sentry.dart'; | ||
|
||
Future<void> main(List<String> arguments) async { | ||
await Sentry.init((options) { | ||
options.dsn = 'https://[email protected]/5428562'; | ||
}); | ||
|
||
print('Hello world: ${perf_test_console_sentry.calculate()}!'); | ||
} | ||
NEW_FILE_CONTENT | ||
else | ||
echo "Error: File $fileToReplace not found!" | ||
exit 1 | ||
fi | ||
echo '::endgroup::' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
needs to be changed for linux