-
-
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
f2981ac
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
324
ops/sec (±1.87%
)293
ops/sec (±0.19%
)0.90
infer All
7340
ops/sec (±0.30%
)5595
ops/sec (±0.24%
)0.76
denormalizeLong
147
ops/sec (±2.00%
)136
ops/sec (±1.07%
)0.93
denormalizeLong with mixin Entity
154
ops/sec (±0.40%
)142
ops/sec (±0.82%
)0.92
denormalizeLong withCache
5500
ops/sec (±1.19%
)4845
ops/sec (±0.87%
)0.88
denormalizeLong All withCache
5707
ops/sec (±0.15%
)4786
ops/sec (±0.11%
)0.84
denormalizeLong Query-sorted withCache
5614
ops/sec (±0.37%
)4816
ops/sec (±0.50%
)0.86
getResponse
5489
ops/sec (±3.55%
)4343
ops/sec (±3.43%
)0.79
getSmallResponse
1892
ops/sec (±3.57%
)1876
ops/sec (±3.15%
)0.99
getSmallInferredResponse
1357
ops/sec (±0.06%
)1570
ops/sec (±0.09%
)1.16
getResponse Query-sorted
531
ops/sec (±0.73%
)461
ops/sec (±1.16%
)0.87
setLong
322
ops/sec (±2.63%
)295
ops/sec (±0.24%
)0.92
setLongWithMerge
131
ops/sec (±0.46%
)123
ops/sec (±0.38%
)0.94
setLongWithSimpleMerge
137
ops/sec (±0.32%
)133
ops/sec (±0.21%
)0.97
This comment was automatically generated by workflow using github-action-benchmark.