Skip to content

Commit 3c776af

Browse files
committed
internal: Rename and reorder core bench
1 parent f17d751 commit 3c776af

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

examples/benchmark/core.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
ProjectSchema,
1414
ProjectSchemaSimpleMerge,
1515
ProjectWithBuildTypesDescriptionSimpleMerge,
16-
ProjectQuerySorted,
16+
getSortedProjects,
1717
User,
1818
ProjectSchemaCollection,
1919
} from './schemas.js';
@@ -132,9 +132,6 @@ export default function addReducerSuite(suite) {
132132
);
133133
}
134134
})
135-
.add('getResponse Query-sorted', () => {
136-
return controller.get(ProjectQuerySorted, cachedState);
137-
})
138135
.add('getResponse Collection', () => {
139136
return controllerCollection.getResponse(
140137
getProjectCollection,
@@ -147,6 +144,9 @@ export default function addReducerSuite(suite) {
147144
collectionState,
148145
);
149146
})
147+
.add('get Query-sorted', () => {
148+
return controller.get(getSortedProjects, cachedState);
149+
})
150150
.add('setLong', () => {
151151
return controller.setResponse(getProject, data);
152152
})

examples/benchmark/normalizr.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ import {
1010
import { printStatus } from './printStatus.js';
1111
import {
1212
ProjectSchema,
13-
ProjectQuery,
14-
ProjectQuerySorted,
13+
AllProjects,
14+
getSortedProjects,
1515
ProjectWithBuildTypesDescription,
1616
ProjectSchemaMixin,
1717
User,
1818
} from './schemas.js';
1919
import userData from './user.json' with { type: 'json' };
2020

2121
const { result, entities } = normalize(ProjectSchema, data);
22-
const queryState = normalize(ProjectQuery, data);
22+
const queryState = normalize(AllProjects, data);
2323
const queryMemo = new MemoCache();
2424
queryState.result = queryMemo.buildQueryKey(
25-
ProjectQuery,
25+
AllProjects,
2626
[],
2727
queryState.entities,
2828
queryState.indexes,
2929
);
3030
const queryInfer = queryMemo.buildQueryKey(
31-
ProjectQuerySorted,
31+
getSortedProjects,
3232
[],
3333
queryState.entities,
3434
queryState.indexes,
@@ -47,7 +47,7 @@ export default function addNormlizrSuite(suite) {
4747
const memo = new MemoCache();
4848
// prime the cache
4949
memo.denormalize(ProjectSchema, result, entities, []);
50-
memo.denormalize(ProjectQuery, queryState.result, queryState.entities, []);
50+
memo.denormalize(AllProjects, queryState.result, queryState.entities, []);
5151

5252
let curState = initialState;
5353
return suite
@@ -57,7 +57,7 @@ export default function addNormlizrSuite(suite) {
5757
})
5858
.add('infer All', () => {
5959
return new MemoCache().buildQueryKey(
60-
ProjectQuery,
60+
AllProjects,
6161
[],
6262
queryState.entities,
6363
queryState.indexes,
@@ -102,15 +102,15 @@ export default function addNormlizrSuite(suite) {
102102
})
103103
.add('denormalizeLong All withCache', () => {
104104
return memo.denormalize(
105-
ProjectQuery,
105+
AllProjects,
106106
queryState.result,
107107
queryState.entities,
108108
[],
109109
);
110110
})
111111
.add('denormalizeLong Query-sorted withCache', () => {
112112
return memo.denormalize(
113-
ProjectQuerySorted,
113+
getSortedProjects,
114114
queryInfer,
115115
queryState.entities,
116116
[],

examples/benchmark/schemas.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ export const ProjectSchemaMixin = {
8787
project: [ProjectWithBuildTypesDescriptionEntity],
8888
};
8989

90-
export const ProjectQuery = {
90+
export const AllProjects = {
9191
project: new schema.All(ProjectWithBuildTypesDescription),
9292
};
93-
export const ProjectQuerySorted = new schema.Query(
93+
export const getSortedProjects = new schema.Query(
9494
new schema.All(ProjectWithBuildTypesDescription),
9595
entries => {
9696
return [...entries].sort((a, b) => a.name.localeCompare(b.name));

0 commit comments

Comments
 (0)