Skip to content

Commit f803515

Browse files
committed
minify benchmark scores + add more samples
1 parent f31fbb6 commit f803515

File tree

4 files changed

+47
-1790
lines changed

4 files changed

+47
-1790
lines changed

db-service/bench/cqn4sql/model/schema.cds

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ entity Books {
88
genre : Association to Genres;
99
}
1010

11+
entity BooksWithCalc : Books {
12+
authorFullName = author.firstName || ' ' || author.lastName;
13+
}
14+
1115
entity Authors {
12-
key ID : Integer;
13-
name : String;
14-
books : Association to many Books
15-
on books.author = $self;
16+
key ID : Integer;
17+
firstName : String;
18+
lastName : String;
19+
dateOfBirth : Date;
20+
dateOfDeath : Date;
21+
books : Association to many Books
22+
on books.author = $self;
1623
}
1724

1825
entity Genres {

db-service/bench/cqn4sql/performance-benchmarks.test.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ if (process.env.CDS_BENCH === 'true') {
2424
})
2525

2626
runBenchmarkFor('select simple', cds.ql`SELECT from my.Books { ID }`)
27+
28+
runBenchmarkFor('select wildcard', cds.ql`SELECT from my.Books { * }`)
29+
runBenchmarkFor('select wildcard with calculated element', cds.ql`SELECT from my.BooksWithCalc { * }`)
2730

2831
runBenchmarkFor('expand simple', cds.ql`SELECT from my.Authors { ID, books { title } }`)
2932
runBenchmarkFor('expand recursive (depth 3)', cds.ql`SELECT from my.Genres { ID, parent { parent { parent { name }}} }`)
@@ -32,15 +35,28 @@ if (process.env.CDS_BENCH === 'true') {
3235
runBenchmarkFor('exists simple with path expression', cds.ql`SELECT from my.Genres { ID } where exists parent[parent.name = 'foo']`)
3336
runBenchmarkFor('exists recursive (depth 3)', cds.ql`SELECT from my.Genres { ID } where exists parent.parent.parent`)
3437

35-
runBenchmarkFor('assoc2join simple', cds.ql`SELECT from my.Books { ID, author.name }`)
38+
runBenchmarkFor('assoc2join simple', cds.ql`SELECT from my.Books { ID, author.firstName }`)
3639
runBenchmarkFor('assoc2join recursive (depth 3)', cds.ql`SELECT from my.Genres { ID, parent.parent.parent.name }`)
3740

3841
})
3942

4043

4144
function runBenchmarkFor(name, cqn) {
42-
it(name, async () => report(await perf.fn(() => {
43-
cqn4sql(cqn)
44-
}, { title: name })))
45+
it(name, async () =>
46+
report(
47+
await perf.fn(
48+
() => {
49+
cqn4sql(cqn)
50+
},
51+
{
52+
title: name,
53+
warmup: {
54+
duration: '3s',
55+
},
56+
duration: '10s',
57+
},
58+
),
59+
),
60+
)
4561
}
4662
}

0 commit comments

Comments
 (0)