Skip to content

Commit f31fbb6

Browse files
committed
only run if requested
1 parent 589006c commit f31fbb6

File tree

3 files changed

+240
-41
lines changed

3 files changed

+240
-41
lines changed

.github/workflows/cqn4sql-benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
# this needs the cds-test PR to be merged first
3636
# - name: Run benchmarks
3737
# run: |
38-
# cd ./db-service/bench/cqn4sql && cds test
38+
# cd ./db-service/bench/cqn4sql && CDS_BENCH=true cds test
3939

4040
- name: Build visualization
4141
run: |
Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,46 @@
11
'use strict'
22

3-
const cds = require('@sap/cds')
4-
const { writeDump } = require('./utils/format-benchmarks')
5-
6-
let cqn4sql = require('../../lib/cqn4sql')
7-
8-
const {
9-
perf,
10-
} = cds.test
11-
12-
const report = (what, options) => perf.report(what, { store: true, stats: { requests: true }, ...options })
13-
14-
describe('cqn4sql performance benchmarks', () => {
15-
beforeEach(async () => {
16-
const m = await cds.load([__dirname + '/model/schema']).then(cds.linked)
17-
const orig = cqn4sql // keep reference to original to avoid recursion
18-
cqn4sql = q => orig(q, m)
3+
if (process.env.CDS_BENCH === 'true') {
4+
const cds = require('@sap/cds')
5+
const { writeDump } = require('./utils/format-benchmarks')
6+
7+
let cqn4sql = require('../../lib/cqn4sql')
8+
9+
const {
10+
perf,
11+
} = cds.test
12+
13+
const report = (what, options) => perf.report(what, { store: true, stats: { requests: true }, ...options })
14+
15+
describe('cqn4sql performance benchmarks', () => {
16+
beforeEach(async () => {
17+
const m = await cds.load([__dirname + '/model/schema']).then(cds.linked)
18+
const orig = cqn4sql // keep reference to original to avoid recursion
19+
cqn4sql = q => orig(q, m)
20+
})
21+
22+
after('format & write dump', () => {
23+
writeDump({ testFile: __filename })
24+
})
25+
26+
runBenchmarkFor('select simple', cds.ql`SELECT from my.Books { ID }`)
27+
28+
runBenchmarkFor('expand simple', cds.ql`SELECT from my.Authors { ID, books { title } }`)
29+
runBenchmarkFor('expand recursive (depth 3)', cds.ql`SELECT from my.Genres { ID, parent { parent { parent { name }}} }`)
30+
31+
runBenchmarkFor('exists simple', cds.ql`SELECT from my.Genres { ID } where exists parent`)
32+
runBenchmarkFor('exists simple with path expression', cds.ql`SELECT from my.Genres { ID } where exists parent[parent.name = 'foo']`)
33+
runBenchmarkFor('exists recursive (depth 3)', cds.ql`SELECT from my.Genres { ID } where exists parent.parent.parent`)
34+
35+
runBenchmarkFor('assoc2join simple', cds.ql`SELECT from my.Books { ID, author.name }`)
36+
runBenchmarkFor('assoc2join recursive (depth 3)', cds.ql`SELECT from my.Genres { ID, parent.parent.parent.name }`)
37+
1938
})
20-
21-
after('format & write dump', () => {
22-
writeDump({ testFile: __filename })
23-
})
24-
25-
runBenchmarkFor('select simple', cds.ql`SELECT from my.Books { ID }`)
26-
27-
runBenchmarkFor('expand simple', cds.ql`SELECT from my.Authors { ID, books { title } }`)
28-
runBenchmarkFor('expand recursive (depth 3)', cds.ql`SELECT from my.Genres { ID, parent { parent { parent { name }}} }`)
29-
30-
runBenchmarkFor('exists simple', cds.ql`SELECT from my.Genres { ID } where exists parent`)
31-
runBenchmarkFor('exists simple with path expression', cds.ql`SELECT from my.Genres { ID } where exists parent[parent.name = 'foo']`)
32-
runBenchmarkFor('exists recursive (depth 3)', cds.ql`SELECT from my.Genres { ID } where exists parent.parent.parent`)
33-
34-
runBenchmarkFor('assoc2join simple', cds.ql`SELECT from my.Books { ID, author.name }`)
35-
runBenchmarkFor('assoc2join recursive (depth 3)', cds.ql`SELECT from my.Genres { ID, parent.parent.parent.name }`)
36-
37-
})
38-
39-
40-
function runBenchmarkFor(name, cqn) {
41-
it(name, async () => report(await perf.fn(() => {
42-
cqn4sql(cqn)
43-
}, { title: name })))
39+
40+
41+
function runBenchmarkFor(name, cqn) {
42+
it(name, async () => report(await perf.fn(() => {
43+
cqn4sql(cqn)
44+
}, { title: name })))
45+
}
4446
}

db-service/bench/cqn4sql/results/cqn4sql-benchmarks.json

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,5 +1579,202 @@
15791579
"sent": 132577
15801580
}
15811581
}
1582+
},
1583+
"589006ca": {
1584+
"date": "2025-08-27T16:51:33.834Z",
1585+
"benchmarks": {
1586+
"select simple": {
1587+
"average": 88736,
1588+
"mean": 88736,
1589+
"stddev": 832,
1590+
"min": 87931,
1591+
"max": 89539,
1592+
"total": 266153,
1593+
"p0_001": 87935,
1594+
"p0_01": 87935,
1595+
"p0_1": 87935,
1596+
"p1": 87935,
1597+
"p2_5": 87935,
1598+
"p10": 87935,
1599+
"p25": 87935,
1600+
"p50": 87935,
1601+
"p75": 89599,
1602+
"p90": 89599,
1603+
"p97_5": 89599,
1604+
"p99": 89599,
1605+
"p99_9": 89599,
1606+
"p99_99": 89599,
1607+
"p99_999": 89599,
1608+
"sent": 266153
1609+
},
1610+
"expand simple": {
1611+
"average": 20176,
1612+
"mean": 20176,
1613+
"stddev": 360,
1614+
"min": 19820,
1615+
"max": 20536,
1616+
"total": 61070,
1617+
"p0_001": 19823,
1618+
"p0_01": 19823,
1619+
"p0_1": 19823,
1620+
"p1": 19823,
1621+
"p2_5": 19823,
1622+
"p10": 19823,
1623+
"p25": 19823,
1624+
"p50": 19823,
1625+
"p75": 20543,
1626+
"p90": 20543,
1627+
"p97_5": 20543,
1628+
"p99": 20543,
1629+
"p99_9": 20543,
1630+
"p99_99": 20543,
1631+
"p99_999": 20543,
1632+
"sent": 61070
1633+
},
1634+
"expand recursive (depth 3)": {
1635+
"average": 8213,
1636+
"mean": 8213,
1637+
"stddev": 119,
1638+
"min": 8095,
1639+
"max": 8335,
1640+
"total": 24564,
1641+
"p0_001": 8095,
1642+
"p0_01": 8095,
1643+
"p0_1": 8095,
1644+
"p1": 8095,
1645+
"p2_5": 8095,
1646+
"p10": 8095,
1647+
"p25": 8095,
1648+
"p50": 8095,
1649+
"p75": 8335,
1650+
"p90": 8335,
1651+
"p97_5": 8335,
1652+
"p99": 8335,
1653+
"p99_9": 8335,
1654+
"p99_99": 8335,
1655+
"p99_999": 8335,
1656+
"sent": 24564
1657+
},
1658+
"exists simple": {
1659+
"average": 59808,
1660+
"mean": 59808,
1661+
"stddev": 816,
1662+
"min": 58977,
1663+
"max": 60620,
1664+
"total": 179837,
1665+
"p0_001": 59007,
1666+
"p0_01": 59007,
1667+
"p0_1": 59007,
1668+
"p1": 59007,
1669+
"p2_5": 59007,
1670+
"p10": 59007,
1671+
"p25": 59007,
1672+
"p50": 59007,
1673+
"p75": 60639,
1674+
"p90": 60639,
1675+
"p97_5": 60639,
1676+
"p99": 60639,
1677+
"p99_9": 60639,
1678+
"p99_99": 60639,
1679+
"p99_999": 60639,
1680+
"sent": 179837
1681+
},
1682+
"exists simple with path expression": {
1683+
"average": 23472,
1684+
"mean": 23472,
1685+
"stddev": 8,
1686+
"min": 23471,
1687+
"max": 23478,
1688+
"total": 70623,
1689+
"p0_001": 23471,
1690+
"p0_01": 23471,
1691+
"p0_1": 23471,
1692+
"p1": 23471,
1693+
"p2_5": 23471,
1694+
"p10": 23471,
1695+
"p25": 23471,
1696+
"p50": 23471,
1697+
"p75": 23487,
1698+
"p90": 23487,
1699+
"p97_5": 23487,
1700+
"p99": 23487,
1701+
"p99_9": 23487,
1702+
"p99_99": 23487,
1703+
"p99_999": 23487,
1704+
"sent": 70623
1705+
},
1706+
"exists recursive (depth 3)": {
1707+
"average": 42112,
1708+
"mean": 42112,
1709+
"stddev": 720,
1710+
"min": 41377,
1711+
"max": 42833,
1712+
"total": 126500,
1713+
"p0_001": 41407,
1714+
"p0_01": 41407,
1715+
"p0_1": 41407,
1716+
"p1": 41407,
1717+
"p2_5": 41407,
1718+
"p10": 41407,
1719+
"p25": 41407,
1720+
"p50": 41407,
1721+
"p75": 42847,
1722+
"p90": 42847,
1723+
"p97_5": 42847,
1724+
"p99": 42847,
1725+
"p99_9": 42847,
1726+
"p99_99": 42847,
1727+
"p99_999": 42847,
1728+
"sent": 126500
1729+
},
1730+
"assoc2join simple": {
1731+
"average": 52768,
1732+
"mean": 52768,
1733+
"stddev": 1552,
1734+
"min": 51214,
1735+
"max": 54312,
1736+
"total": 145122,
1737+
"p0_001": 51231,
1738+
"p0_01": 51231,
1739+
"p0_1": 51231,
1740+
"p1": 51231,
1741+
"p2_5": 51231,
1742+
"p10": 51231,
1743+
"p25": 51231,
1744+
"p50": 51231,
1745+
"p75": 54335,
1746+
"p90": 54335,
1747+
"p97_5": 54335,
1748+
"p99": 54335,
1749+
"p99_9": 54335,
1750+
"p99_99": 54335,
1751+
"p99_999": 54335,
1752+
"sent": 145122
1753+
},
1754+
"assoc2join recursive (depth 3)": {
1755+
"average": 45296,
1756+
"mean": 45296,
1757+
"stddev": 128,
1758+
"min": 45177,
1759+
"max": 45433,
1760+
"total": 136314,
1761+
"p0_001": 45183,
1762+
"p0_01": 45183,
1763+
"p0_1": 45183,
1764+
"p1": 45183,
1765+
"p2_5": 45183,
1766+
"p10": 45183,
1767+
"p25": 45183,
1768+
"p50": 45183,
1769+
"p75": 45439,
1770+
"p90": 45439,
1771+
"p97_5": 45439,
1772+
"p99": 45439,
1773+
"p99_9": 45439,
1774+
"p99_99": 45439,
1775+
"p99_999": 45439,
1776+
"sent": 136314
1777+
}
1778+
}
15821779
}
15831780
}

0 commit comments

Comments
 (0)