Skip to content

Commit cdf3ff5

Browse files
authored
Merge pull request #7009 from neo4j/update-perf-tests
Add memory to performance tests summary
2 parents 9b6e65d + cac389b commit cdf3ff5

File tree

7 files changed

+30
-71
lines changed

7 files changed

+30
-71
lines changed

packages/graphql/tests/performance/databaseQuery/TestRunner.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import assert from "assert";
21-
import type { Driver, ProfiledPlan } from "neo4j-driver";
21+
import type { Driver, Integer, ProfiledPlan } from "neo4j-driver";
2222
import type Neo4jGraphQL from "../../../src/classes/Neo4jGraphQL";
2323
import { translateQuery } from "../../tck/utils/tck-test-utils";
2424
import type * as Performance from "../types";
@@ -120,6 +120,7 @@ export class TestRunner {
120120
const nodeResult: Performance.ProfileResult = {
121121
maxRows: plan.rows,
122122
dbHits: plan.dbHits,
123+
memory: this.getMemoryFromPlan(plan),
123124
cache: {
124125
hits: plan.pageCacheHits,
125126
misses: plan.pageCacheMisses,
@@ -133,6 +134,7 @@ export class TestRunner {
133134
return {
134135
maxRows: Math.max(agg.maxRows, childResult.maxRows),
135136
dbHits: agg.dbHits + childResult.dbHits,
137+
memory: agg.memory + childResult.memory,
136138
cache: {
137139
hits: agg.cache.hits + childResult.cache.hits,
138140
misses: agg.cache.misses + childResult.cache.misses,
@@ -142,4 +144,12 @@ export class TestRunner {
142144

143145
return result;
144146
}
147+
148+
private getMemoryFromPlan(plan: ProfiledPlan): number {
149+
const rawMemory = plan.arguments["Memory"] as Integer | undefined;
150+
if (!rawMemory) {
151+
return 0;
152+
}
153+
return rawMemory.toInt();
154+
}
145155
}

packages/graphql/tests/performance/graphql/fulltext.graphql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,14 @@ query FulltextWithNestedQuery {
2424
}
2525
}
2626
}
27+
28+
query FulltextWithSort {
29+
movieTaglineFulltextQuery(first: 1000, phrase: "*", sort: [{ node: { title: ASC } }]) {
30+
edges {
31+
node {
32+
title
33+
tagline
34+
}
35+
}
36+
}
37+
}

packages/graphql/tests/performance/graphql/query.graphql

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -36,51 +36,7 @@ query Nested {
3636
}
3737
}
3838

39-
query DeeplyNested_skip {
40-
movies {
41-
actors {
42-
name
43-
movies {
44-
title
45-
actors {
46-
name
47-
movies {
48-
title
49-
actors {
50-
name
51-
}
52-
directors {
53-
name
54-
}
55-
}
56-
}
57-
}
58-
}
59-
}
60-
}
61-
62-
query OrFilterOnRelationships {
63-
movies(
64-
where: {
65-
OR: [
66-
{ actors_SOME: { born: { eq: 1997 } } }
67-
{ actors_SOME: { born: { eq: 1998 } } }
68-
{ actors_SOME: { born: { eq: 1999 } } }
69-
{ actors_SOME: { born: { eq: 1956 } } }
70-
{ actors_SOME: { born: { eq: 1975 } } }
71-
{ actors_SOME: { born: { eq: 1976 } } }
72-
]
73-
}
74-
) {
75-
title
76-
actors {
77-
name
78-
born
79-
}
80-
}
81-
}
82-
83-
query OrFilterOnRelationshipsAndNested {
39+
query OrFilterOnRelationshipsAndNestedFilters {
8440
movies(
8541
where: {
8642
OR: [

packages/graphql/tests/performance/graphql/unions.graphql

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,3 @@ query NestedUnion {
4545
}
4646
}
4747
}
48-
49-
query NestedUnionWithMissingFields {
50-
people {
51-
name
52-
likes {
53-
... on Person {
54-
name
55-
likes {
56-
... on Person {
57-
name
58-
}
59-
... on Movie {
60-
title
61-
}
62-
}
63-
}
64-
}
65-
}
66-
}

packages/graphql/tests/performance/schema/schema-performance.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import Neo4jGraphQL from "../../../src/classes/Neo4jGraphQL";
2121

22-
const basicTypeDefs = `
22+
const basicTypeDefs = /* GraphQL */ `
2323
type Journalist @node {
2424
articles: [Article!]! @relationship(type: "HAS_ARTICLE", direction: OUT, properties: "HasArticle")
2525
}
@@ -29,12 +29,12 @@ const basicTypeDefs = `
2929
}
3030
3131
type Article @authorization(filter: [{ where: { node: { id: { eq: "$jwt.sub" } } } }]) @node {
32-
id: ID! @id @authorization(filter: [{ where: { node: { id: { eq: "$jwt.sub" } } } }])
32+
id: ID! @id @authorization(filter: [{ where: { node: { id: { eq: "$jwt.sub" } } } }])
3333
blocks: [Block!]! @relationship(type: "HAS_BLOCK", direction: OUT, properties: "HasBlock")
3434
images: [Image!]! @relationship(type: "HAS_IMAGE", direction: OUT)
3535
}
3636
37-
type HasBlock @relationshipProperties @node {
37+
type HasBlock @relationshipProperties {
3838
order: Int!
3939
}
4040

packages/graphql/tests/performance/schema/subgraph-schema-performance.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import Neo4jGraphQL from "../../../src/classes/Neo4jGraphQL";
2121

22-
const basicTypeDefs = `
22+
const basicTypeDefs = /* GraphQL */ `
2323
extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key"])
2424
2525
type Journalist @node {
@@ -31,12 +31,12 @@ const basicTypeDefs = `
3131
}
3232
3333
type Article @authorization(filter: [{ where: { node: { id: { eq: "$jwt.sub" } } } }]) @node {
34-
id: ID! @id @authorization(filter: [{ where: { node: { id: { eq: "$jwt.sub" } } } }])
34+
id: ID! @id @authorization(filter: [{ where: { node: { id: { eq: "$jwt.sub" } } } }])
3535
blocks: [Block!]! @relationship(type: "HAS_BLOCK", direction: OUT, properties: "HasBlock")
3636
images: [Image!]! @relationship(type: "HAS_IMAGE", direction: OUT)
3737
}
3838
39-
type HasBlock @relationshipProperties @node {
39+
type HasBlock @relationshipProperties {
4040
order: Int!
4141
}
4242

packages/graphql/tests/performance/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export type ProfileResult = {
2424
hits: number;
2525
misses: number;
2626
};
27+
memory: number;
2728
};
2829

2930
export type Result = ProfileResult & { time: number };

0 commit comments

Comments
 (0)