-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "./tsconfig", | ||
"compilerOptions": { | ||
"skipDefaultLibCheck": true, | ||
}, | ||
"include": ["typetest.ts"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useCache, useController, useSuspense } from '@rest-hooks/react'; | ||
|
||
import { queryRemaining, TodoResource } from './src/resources/TodoResource'; | ||
import { UserResource } from './src/resources/UserResource'; | ||
|
||
function useTest() { | ||
const ctrl = useController(); | ||
const payload = { id: 1, title: '', userId: 1 }; | ||
ctrl.fetch(TodoResource.create, payload); | ||
|
||
const todos = useSuspense(TodoResource.getList, { userId: 1 }); | ||
useSuspense(TodoResource.getList); | ||
todos.map((todo) => { | ||
todo.pk(); | ||
todo.title; | ||
ctrl.fetch( | ||
TodoResource.partialUpdate, | ||
{ id: todo.id }, | ||
{ completed: true }, | ||
); | ||
}); | ||
|
||
const remaining = useCache(queryRemaining, { userId: 1 }); | ||
|
||
const users = useSuspense(UserResource.getList); | ||
users.map((user) => { | ||
user.name; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ecdb802
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
normalizeLong
261
ops/sec (±1.27%
)293
ops/sec (±0.19%
)1.12
infer All
5269
ops/sec (±1.51%
)5595
ops/sec (±0.24%
)1.06
denormalizeLong
123
ops/sec (±2.61%
)136
ops/sec (±1.07%
)1.11
denormalizeLong with mixin Entity
131
ops/sec (±1.32%
)142
ops/sec (±0.82%
)1.08
denormalizeLong withCache
4474
ops/sec (±1.16%
)4845
ops/sec (±0.87%
)1.08
denormalizeLong All withCache
4165
ops/sec (±1.03%
)4786
ops/sec (±0.11%
)1.15
denormalizeLong Query-sorted withCache
4104
ops/sec (±0.87%
)4816
ops/sec (±0.50%
)1.17
getResponse
3909
ops/sec (±2.39%
)4343
ops/sec (±3.43%
)1.11
getSmallResponse
1568
ops/sec (±4.78%
)1876
ops/sec (±3.15%
)1.20
getSmallInferredResponse
1399
ops/sec (±1.26%
)1570
ops/sec (±0.09%
)1.12
getResponse Query-sorted
418
ops/sec (±1.82%
)461
ops/sec (±1.16%
)1.10
setLong
264
ops/sec (±1.13%
)295
ops/sec (±0.24%
)1.12
setLongWithMerge
115
ops/sec (±1.10%
)123
ops/sec (±0.38%
)1.07
setLongWithSimpleMerge
118
ops/sec (±1.03%
)133
ops/sec (±0.21%
)1.13
This comment was automatically generated by workflow using github-action-benchmark.