Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 2, 2025. It is now read-only.
/rematchPublic archive

chore: introduced bench testing#887

Draft
semoal wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromwip-rematch-benchs
Draft
Show file tree
Hide file tree
Changes fromall 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
chore: introduced bench testing, still in wip
  • Loading branch information
@semoal
semoal committedMay 24, 2021
commit5c4b36761dc91231c4226efcb0b50483c6cfd545
21 changes: 21 additions & 0 deletionsbenchmarks/benchmark/results/dispatching-async.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
{
"name": "Dispatching asynchronous actions",
"date": "2021-05-24T21:03:21.913Z",
"version": "2.0.1",
"results": [
{
"name": "Rematch",
"ops": 384993,
"margin": 2.01,
"percentSlower": 0
}
],
"fastest": {
"name": "Rematch",
"index": 0
},
"slowest": {
"name": "Rematch",
"index": 0
}
}
21 changes: 21 additions & 0 deletionsbenchmarks/benchmark/results/dispatching.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
{
"name": "Dispatching actions",
"date": "2021-05-24T21:03:28.239Z",
"version": "2.0.1",
"results": [
{
"name": "Rematch",
"ops": 1731896,
"margin": 1.99,
"percentSlower": 0
}
],
"fastest": {
"name": "Rematch",
"index": 0
},
"slowest": {
"name": "Rematch",
"index": 0
}
}
21 changes: 21 additions & 0 deletionsbenchmarks/benchmark/results/init-with-plugins.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
{
"name": "init() function with plugins and some configuration",
"date": "2021-05-24T21:03:40.742Z",
"version": "2.0.1",
"results": [
{
"name": "Rematch",
"ops": 56165,
"margin": 3.8,
"percentSlower": 0
}
],
"fastest": {
"name": "Rematch",
"index": 0
},
"slowest": {
"name": "Rematch",
"index": 0
}
}
21 changes: 21 additions & 0 deletionsbenchmarks/benchmark/results/init.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
{
"name": "init() function initializer",
"date": "2021-05-24T21:03:34.464Z",
"version": "2.0.1",
"results": [
{
"name": "Rematch",
"ops": 108967,
"margin": 3.11,
"percentSlower": 0
}
],
"fastest": {
"name": "Rematch",
"index": 0
},
"slowest": {
"name": "Rematch",
"index": 0
}
}
35 changes: 35 additions & 0 deletionsbenchmarks/dispatching-async.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
import b from 'benny'
import { init } from '@rematch/core'
import pkg from '../packages/core/package.json'

const commonPromise = () => Promise.resolve(1)
const rematchStore = init({
models: {
shop: {
state: {
count: 0,
},
reducers: {
increment(state, payload) {
return {
count: state.count + payload,
}
},
},
effects: () => ({
async incrementEffect() {
const result = await commonPromise()
this.increment(result)
},
}),
},
},
})

b.suite(
'Dispatching asynchronous actions',
b.add('Rematch', async () => rematchStore.dispatch.shop.incrementEffect()),
b.cycle(),
b.complete(),
b.save({ file: 'dispatching-async', version: pkg.version })
)
30 changes: 30 additions & 0 deletionsbenchmarks/dispatching.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
import b from 'benny'
import rematch from '@rematch/core'
import pkg from '../packages/core/package.json'

const rematchStore = rematch.init({
models: {
shop: {
state: {
count: 0,
},
reducers: {
increment(state) {
return {
count: state.count + 1,
}
},
},
},
},
})

b.suite(
'Dispatching actions',
b.add('Rematch', () => {
rematchStore.dispatch.shop.increment()
}),
b.cycle(),
b.complete(),
b.save({ file: 'dispatching', version: pkg.version })
)
36 changes: 36 additions & 0 deletionsbenchmarks/init-with-plugins.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
import b from 'benny'
import { init } from '@rematch/core'

import createLoadingPlugin from '@rematch/loading'
import createUpdatedPlugin from '@rematch/updated'
import pkg from '../packages/core/package.json'

const shop = {
state: {
count: 0,
},
reducers: {
increment(state) {
return {
count: state.count + 1,
}
},
},
}
b.suite(
'init() function with plugins and some configuration',
b.add('Rematch', () => {
init({
models: { shop },
plugins: [createLoadingPlugin(), createUpdatedPlugin()],
redux: {
rootReducers: {
RESET: () => undefined,
},
},
})
}),
b.cycle(),
b.complete(),
b.save({ file: 'init-with-plugins', version: pkg.version })
)
28 changes: 28 additions & 0 deletionsbenchmarks/init.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
import b from 'benny'
import { init } from '@rematch/core'

import pkg from '../packages/core/package.json'

const shop = {
state: {
count: 0,
},
reducers: {
increment(state) {
return {
count: state.count + 1,
}
},
},
}
b.suite(
'init() function initializer',
b.add('Rematch', () => {
init({
models: { shop },
})
}),
b.cycle(),
b.complete(),
b.save({ file: 'init', version: pkg.version })
)
16 changes: 16 additions & 0 deletionsbenchmarks/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
{
"name": "@rematch/benchmarks",
"private": true,
"version": "0.0.0",
"scripts": {
"start": "ts-node dispatching-async.ts && ts-node dispatching.ts && ts-node init.ts && ts-node init-with-plugins.ts"
},
"dependencies": {
"ts-node": "^9.1.1",
"@rematch/core": "^2.0.1",
"@rematch/loading": "^2.0.1",
"@rematch/updated": "^2.0.1",
"benny": "^3.6.15",
"redux": "^4.1.0"
}
}
15 changes: 15 additions & 0 deletionsbenchmarks/tsconfig.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
{
"extends": "ts-node/tsconfig.schema.json",
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true
},
"ts-node": {
"transpileOnly": true,
"files": true,
"compilerOptions": {
"esModuleInterop": true,
"resolveJsonModule": true
}
}
}
3 changes: 3 additions & 0 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,6 +40,7 @@
"lint:docs": "lerna run lint --scope rematch-docs --stream",
"build:docs": "lerna run build --scope rematch-docs --stream",
"size-build": "size-limit",
"benchmarks": "lerna run start --scope=@rematch/benchmarks",
"postbuild": "node ./scripts/moveReadmeToDist.js",
"version:latest:graduate": "lerna version --no-private --create-release github --conventional-commits --conventional-graduate --yes",
"version:latest": "lerna version --no-private --create-release github --conventional-commits --yes",
Expand DownExpand Up@@ -69,6 +70,7 @@
"lerna": "^3.22.1",
"pinst": "^2.1.4",
"prettier": "2.2.1",
"redux": "^4.1.0",
"rimraf": "^3.0.2",
"size-limit": "^4.9.1",
"tsdx": "^0.14.1",
Expand DownExpand Up@@ -122,6 +124,7 @@
"workspaces": [
"packages/*",
"website",
"benchmarks",
"examples/all-plugins-react-ts",
"examples/hooks-react-ts",
"examples/count-react-ts"
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp