Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Enzo Cioppettini
ion
Commits
c77af72a
Commit
c77af72a
authored
6 years ago
by
AdminXVII
Committed by
stratact
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add benchmark and binary size tests to CI
parent
48635419
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+13
-0
13 additions, 0 deletions
.gitlab-ci.yml
benches/terminator.rs
+3
-3
3 additions, 3 deletions
benches/terminator.rs
ci/run_benchmark.sh
+71
-0
71 additions, 0 deletions
ci/run_benchmark.sh
with
87 additions
and
3 deletions
.gitlab-ci.yml
+
13
−
0
View file @
c77af72a
...
...
@@ -50,3 +50,16 @@ pages:
-
public
only
:
-
master
compare-benchmarks
:
image
:
rustlang/rust:nightly
stage
:
test
allow_failure
:
true
except
:
[
master
]
script
:
-
apt-get update && apt-get install -y build-essential libboost-dev jq bc
-
sh ./ci/run_benchmark.sh
artifacts
:
reports
:
junit
:
target/report.xml
paths
:
[
target/criterion
]
This diff is collapsed.
Click to expand it.
benches/terminator.rs
+
3
−
3
View file @
c77af72a
#[macro_use]
extern
crate
criterion
;
use
criterion
::
*
;
use
ion_shell
::
parser
::
Terminator
;
use
std
::
time
::
Duration
;
const
TEXT
:
&
str
=
include_str!
(
"test.ion"
);
const
EOF
:
&
str
=
include_str!
(
"herestring.ion"
);
...
...
@@ -22,6 +20,8 @@ fn criterion_benchmark(c: &mut Criterion) {
},
vec!
[
TEXT
,
EOF
],
)
.warm_up_time
(
Duration
::
from_secs
(
10
))
.measurement_time
(
Duration
::
from_secs
(
300
))
.throughput
(|
script
|
Throughput
::
Bytes
(
script
.len
()
as
u32
)),
);
}
...
...
This diff is collapsed.
Click to expand it.
ci/run_benchmark.sh
0 → 100755
+
71
−
0
View file @
c77af72a
#!/bin/sh
git checkout origin/master
cargo bench
cargo build
--release
PREV_SIZE
=
$(
ls
-al
target/release/ion |
cut
-d
' '
-f5
)
git reset
--hard
HEAD
git checkout -
cargo bench
cargo build
--release
SIZE
=
$(
ls
-al
target/release/ion |
cut
-d
' '
-f5
)
# if lower_bound*upper_bound > 0, then we consider the benchmark "changed"
NOISE
=
0.05
JQ_FILTER
=
"if .Median.confidence_interval.lower_bound >
$NOISE
or .Median.confidence_interval.upper_bound < -
$NOISE
then .Median.point_estimate else
\"\"
end"
total
=
0
total_worse
=
0
result
=
""
for
suite
in
./target/criterion/
*
;
do
name
=
$(
echo
$suite
|
cut
-d
'/'
-f
4
)
worse
=
0
tests
=
0
testcases
=
""
for
test
in
$suite
/
*
/
*
/change/estimates.json
;
do
estimate
=
$(
cat
"
$test
"
| jq
-r
"
$JQ_FILTER
"
-c
)
case
"
$estimate
"
in
-
*
)
inner
=
"<failure message=
\"
Performance Regressed
\"
type=
\"
WARNING
\"
>
\
Performance regressed by
$estimate
in
$test
\
</failure>"
worse
=
$((
worse+1
))
;;
esac
testcases
=
"
$testcases
<testcase id=
\"
$(
echo
"
$test
"
|
cut
-d
'/'
-f
6
)
\"
name=
\"
$(
echo
"
$test
"
|
cut
-d
'/'
-f
6
)
\"
>
$inner
</testcase>"
tests
=
$((
tests+1
))
done
result
=
"
$result
<testsuite id=
\"
$name
\"
name=
\"
$name
\"
tests=
\"
$tests
\"
failures=
\"
$worse
\"
>
$testcases
</testsuite>"
total_worse
=
$((
total_worse
+
worse
))
total
=
$((
total
+
tests
))
done
binary
=
$(
test
$(
echo
"
$PREV_SIZE
* 105 / 100"
| bc
)
-ge
$SIZE
;
echo
$?
)
result
=
"
$result
\
<testsuite id=
\"
size
\"
name=
\"
Binary size
\"
tests=
\"
1
\"
failures=
\"
$binary
\"
>
\
<testcase id=
\"
size
\"
name=
\"
Binary size
\"
>"
total
=
$((
total
+
1
))
if
[
!
"
$binary
"
-eq
"0"
]
;
then
result
=
"
$result
\
<failure message=
\"
Binary size increased
\"
type=
\"
WARNING
\"
>
\
Binary size increased from
$PREV_SIZE
to
$SIZE
.
\
</failure>"
total_worse
=
$((
total_worse
+
1
))
fi
result
=
"
$result
</testcase></testsuite>"
result
=
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
<testsuites id=
\"
$(
date
+%s
)
\"
name=
\"
Performances
\"
tests=
\"
$total
\"
failures=
\"
$total_worse
\"
>
$result
</testsuites>"
echo
$result
>
target/report.xml
exit
$(
test
"
$total_worse
"
-eq
"0"
;
echo
$?
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment