Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-backend",
"comment": "Add performance test for concurrent query",
"type": "none"
}
],
"packageName": "@itwin/core-backend"
}
2 changes: 1 addition & 1 deletion core/backend/src/test/ecdb/ConcurrentQuery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe("ConcurrentQuery", () => {
expect(resp.stats.cpuTime).to.be.closeTo(1000970, 500000);
expect(resp.stats.totalTime).to.be.closeTo(1001, 100);
expect(resp.stats.memUsed).to.be.closeTo(2, 3);
expect(resp.stats.prepareTime).to.be.closeTo(0, 2);
expect(resp.stats.prepareTime).to.be.closeTo(0, 4);
db.close();
});

Expand Down
2 changes: 1 addition & 1 deletion core/backend/src/test/ecdb/ECDb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe("ECDb", () => {
alias: "source",
fileName: path.join(outDir, "source_file.ecdb"),
profile: "SQLite"
}
},
]);
testECDb1.detachDb("source");
expect(await runDbListPragmaCCQ(testECDb1)).deep.equals([
Expand Down
10 changes: 8 additions & 2 deletions core/backend/src/test/ecdb/ECSqlStatement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3431,8 +3431,14 @@ describe("ECSqlStatement", () => {
parentHasChildrenClassId = reader.current.ECInstanceId;
assert.isTrue(Id64.isValidId64(parentHasChildrenClassId));

// When the ECSql insert validation is set to true, the invalid relClassId is detected and an error is thrown.
assert.isTrue(await (ecdb.createQueryReader("PRAGMA validate_ecsql_writes=true")).step());
// Enable ECSql write-value validation so invalid relClassIds are detected and an error is thrown.
// This must be set synchronously on the primary connection (the connection on which the write
// statements below are prepared and validated). It cannot be set via `createQueryReader`, whose
// concurrent-query path executes the pragma on a separate worker connection that does not affect
// the primary connection's write validation.
ecdb.withWriteStatement("PRAGMA validate_ecsql_writes=true", (stmt: ECSqlWriteStatement) => {
Comment thread
aruniverse marked this conversation as resolved.
assert.equal(stmt.step(), DbResult.BE_SQLITE_ROW);
});

reader = ecdb.createQueryReader("SELECT ECInstanceId FROM meta.ECClassDef WHERE Name='ParentHasChildren'");
assert.isTrue(await reader.step());
Expand Down
1 change: 1 addition & 0 deletions full-stack-tests/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"perftest:schemaloader": "npm run -s perftest:pre && mocha --timeout=999999999 \"./lib/cjs/perftest/SchemaLoader.test.js\"",
"perftest:ecSqlRowPerformance": "npm run -s perftest:pre && mocha --timeout=999999999 \"./lib/cjs/perftest/ECSqlRow.test.js\"",
"perftest:readQueryPerformance": "npm run -s perftest:pre && mocha --timeout=999999999 \"./lib/cjs/perftest/ReadQueryPerf.test.js\"",
"perftest:ecSqlReaderConcurrent": "npm run -s perftest:pre && mocha --timeout=999999999 \"./lib/cjs/perftest/ECSqlReaderConcurrentPerf.test.js\"",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to run them as part of some pipeline as well? Also, do we want to generate an artifact to record the performance numbers so that we can see how performance number change in future?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It be great to track performance.

"perftest:metadataPerformance": "npm run -s perftest:pre && mocha --timeout=999999999 --grep PerformanceElementGetMetadata \"./lib/cjs/perftest/ElementCRUD.test.js\"",
"perftest:schemaContextPerformance": "npm run -s perftest:pre && mocha --timeout=999999999 \"./lib/cjs/perftest/SchemaContextIModelDb.test.js\"",
"perftest:sqliteChangesetReaderAndChangesetECAdaptorPerformance": "npm run -s perftest:pre && mocha --timeout=999999999 --grep SqliteChangesetReaderAndChangesetECAdaptorAPI \"./lib/cjs/perftest/SQliteChangesetReaderAndChangesetECAdaptor.test.js\"",
Expand Down
Loading
Loading