Skip to content

Commit 3f726df

Browse files
committed
Merge branch 'master' into experiment-any-mongo
2 parents 2e87da0 + 34bf3d8 commit 3f726df

File tree

98 files changed

+2707
-1373
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2707
-1373
lines changed

.evergreen/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,11 @@ functions:
268268
type: test
269269
params:
270270
binary: bash
271+
add_expansions_to_env: true
271272
env:
272273
VERSION_ID: ${version_id}
274+
BASE_SHA: "${revision}"
275+
HEAD_SHA: "${github_commit}"
273276
include_expansions_in_env: [PERF_URI_PRIVATE_ENDPOINT]
274277
args: [*task-runner, perf-pr-comment]
275278

@@ -669,6 +672,7 @@ tasks:
669672
params:
670673
binary: bash
671674
args: [*task-runner, driver-benchmark]
675+
- func: assume-test-secrets-ec2-role
672676
- func: send-perf-data
673677
- func: send-perf-pr-comment
674678

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
priority-3-low:
1+
review-priority-normal:
22
- changed-files:
33
- any-glob-to-any-file: '*'
44

.github/workflows/codeql.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@ name: "CodeQL"
22

33
on:
44
push:
5-
branches: [ "v1", "cloud-*", "master", "release/*" ]
5+
branches:
6+
- "v1"
7+
- "cloud-*"
8+
- "master"
9+
- "release/*"
10+
- "feature/*"
611
pull_request:
7-
branches: [ "v1", "cloud-*", "master", "release/*" ]
12+
branches:
13+
- "v1"
14+
- "cloud-*"
15+
- "master"
16+
- "release/*"
17+
- "feature/*"
818
schedule:
919
- cron: '36 17 * * 0'
1020
workflow_call:

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ go.work.sum
2525
.task
2626
env.sh
2727
expansion.yml
28+
bin
2829

2930
# AWS SAM-generated files
3031
internal/cmd/faas/awslambda/.aws-sam
@@ -38,6 +39,10 @@ internal/cmd/compilecheck/compilecheck.so
3839
api-report.md
3940
api-report.txt
4041

42+
# Ignore perf report files
43+
perf-report.md
44+
perf-report.txt
45+
4146
# Ignore secrets files
4247
secrets-expansion.yml
4348
secrets-export.sh

bson/raw_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ func BenchmarkRawString(b *testing.B) {
450450
b.ReportAllocs()
451451
b.ResetTimer()
452452
for i := 0; i < b.N; i++ {
453-
_ = bsoncore.Document(bs).StringN(1024) // Assuming you want to limit to 1024 bytes for this benchmark
453+
_, _ = bsoncore.Document(bs).StringN(1024) // Assuming you want to limit to 1024 bytes for this benchmark
454454
}
455455
})
456456
}
@@ -473,7 +473,7 @@ func TestComplexDocuments_StringN(t *testing.T) {
473473
bson, _ := Marshal(tc.doc)
474474
bsonDoc := bsoncore.Document(bson)
475475

476-
got := bsonDoc.StringN(tc.n)
476+
got, _ := bsonDoc.StringN(tc.n)
477477
assert.Equal(t, tc.n, len(got))
478478
})
479479
}
@@ -518,7 +518,7 @@ func createMassiveArraysDocument(arraySize int) D {
518518
func createUniqueVoluminousDocument(t *testing.T, size int) bsoncore.Document {
519519
t.Helper()
520520

521-
docs := make(D, size)
521+
docs := make(D, 0, size)
522522

523523
for i := 0; i < size; i++ {
524524
docs = append(docs, E{
@@ -561,7 +561,7 @@ func createLargeSingleDoc(t *testing.T) bsoncore.Document {
561561
func createVoluminousArrayDocuments(t *testing.T, size int) bsoncore.Document {
562562
t.Helper()
563563

564-
docs := make(D, size)
564+
docs := make(D, 0, size)
565565

566566
for i := 0; i < size; i++ {
567567
docs = append(docs, E{

etc/perf-pr-comment.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,22 @@
55
set -eux
66

77
pushd ./internal/cmd/perfcomp >/dev/null || exist
8-
GOWORK=off go run main.go --project="mongo-go-driver" ${VERSION_ID}
8+
GOWORK=off go build -o ../../../bin/perfcomp .
99
popd >/dev/null
10+
11+
# Generate perf report.
12+
GOWORK=off ./bin/perfcomp compare --project="mongo-go-driver" ${VERSION_ID} > ./internal/cmd/perfcomp/perf-report.txt
13+
14+
if [[ -n "${BASE_SHA+set}" && -n "${HEAD_SHA+set}" && "$BASE_SHA" != "$HEAD_SHA" ]]; then
15+
# Parse and generate perf comparison comment.
16+
GOWORK=off ./bin/perfcomp mdreport
17+
# Make the PR comment.
18+
target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh
19+
bash $target -m "## 🧪 Performance Results" -c "$(pwd)/perf-report.md" -h $HEAD_SHA -o "mongodb" -n "mongo-go-driver"
20+
rm ./perf-report.md
21+
else
22+
# Skip comment if it isn't a PR run.
23+
echo "Skipping Perf PR comment"
24+
fi
25+
26+
rm ./internal/cmd/perfcomp/perf-report.txt

internal/bsoncoreutil/bsoncoreutil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package bsoncoreutil
88

99
// Truncate truncates a given string for a certain width
1010
func Truncate(str string, width int) string {
11-
if width == 0 {
11+
if width <= 0 {
1212
return ""
1313
}
1414

0 commit comments

Comments
 (0)