Skip to content
Myr

fix: release and publish from 'main' rather than 'master' branch

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michel Weststrate · committed by Michel Weststrate · parent 3eeb331 · Browse files · 6 files+15 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+15 added−13 removed

  • other:+15 added−13 removed

6 files+15 added−13 removed

modified:.github/workflows/docs-public.yml+1 added-3 removed
modified:.github/workflows/release.yml+1 added-1 removed
modified:website/docs/performance.mdx+5 added-3 removed
7 unmodified lines
8 data-ea-publisher="immerjs"9 data-ea-type="image"10 className="horizontal bordered"11 ></div>12</center> <details>12</center>13<details>14 <summary className="egghead-summary">15 egghead.io lesson 5: Leveraging Immer's structural sharing in React16 </summary>17 <br />
10 unmodified lines
28 href="https://egghead.io/lessons/react-profile-react-rendering-and-optimize-with-memo-to-leverage-structural-sharing"29 >30 Hosted on egghead.io31 </a>31</details> <details>32</details>33<details>34 <summary className="egghead-summary">35 egghead.io lesson 7: Immer will try to re-cycle data if there was no36 semantic change37 </summary>
13 unmodified lines
51 Hosted on egghead.io52 </a>53</details>5453Here is a [simple benchmark](https://github.com/immerjs/immer/blob/master/__performance_tests__/todo.js) on the performance of Immer. This test takes 50,000 todo items and updates 5,000 of them. _Freeze_ indicates that the state tree has been frozen after producing it. This is a _development_ best practice, as it prevents developers from accidentally modifying the state tree.55Here is a [simple benchmark](https://github.com/immerjs/immer/blob/main/__performance_tests__/todo.js) on the performance of Immer. This test takes 50,000 todo items and updates 5,000 of them. _Freeze_ indicates that the state tree has been frozen after producing it. This is a _development_ best practice, as it prevents developers from accidentally modifying the state tree.5657Something that isn't reflected in the numbers above, but in reality, Immer is sometimes significantly _faster_ than a hand written reducer. The reason for that is that Immer will detect "no-op" state changes, and return the original state if nothing actually changed, which can avoid a lot of re-renderings for example. Cases are known where simply applying immer solved critical performance issues.5859These tests were executed on Node 10.16.3. Use `yarn test:perf` to reproduce them locally.
27 unmodified lines
modified:website/i18n/zh-CN/docusaurus-plugin-content-docs/current/performance.mdx+6 added-4 removed
7 unmodified lines
8 data-ea-publisher="immerjs"9 data-ea-type="image"10 className="horizontal bordered"11 ></div>12</center> <details>12</center>13<details>14 <summary className="egghead-summary">15 egghead.io 第5课: 在 React 中利用 Immer 的结构共享16 </summary>17 <br />
10 unmodified lines
28 href="https://egghead.io/lessons/react-profile-react-rendering-and-optimize-with-memo-to-leverage-structural-sharing"29 >30 Hosted on egghead.io31 </a>31</details> <details>32</details>33<details>34 <summary className="egghead-summary">35 egghead.io 第7课: 如果没有语义变化,Immer 会使用原先的数据36 </summary>37 <br />
12 unmodified lines
50 Hosted on egghead.io51 </a>52</details>5352这是一个关于 Immer 性能的 [简单 benchmark](https://github.com/immerjs/immer/blob/master/__performance_tests__/todo.js) 。该测试需要 50,000 个待办事项并更新其中的 5,000 个。 _Freeze_ 表示状态树在生成后已被冻结。这是一种开发最佳实践,因为它可以防止开发人员意外修改状态树。54这是一个关于 Immer 性能的 [简单 benchmark](https://github.com/immerjs/immer/blob/main/__performance_tests__/todo.js) 。该测试需要 50,000 个待办事项并更新其中的 5,000 个。 _Freeze_ 表示状态树在生成后已被冻结。这是一种开发最佳实践,因为它可以防止开发人员意外修改状态树。5556上面的数字没有反映一些东西,但实际上,Immer 有时比手写的 reducer _快_ 得多。这样做的原因是,Immer 会检测“无操作”状态变化,如果实际上没有任何变化,则返回原始状态,这可以避免很多重新渲染。众所周知,只需应用 immer 即可解决关键性能问题。5758这些测试在 Node 10.16.3 上执行。使用 `yarn test:perf` 在本地重现它们。
10 unmodified lines
69## 性能提示7071### 预冻结数据7271当向 Immer producer 中的状态树添加大型数据集时(例如从 JSON 端点接收的数据),可以在首先添加的数据的根上调用 `freeze(json)` ,来_浅冻结_它。这将允许 Immer 更快地将新数据添加到树中,因为它将避免_递归_扫描和冻结新数据的需要。73当向 Immer producer 中的状态树添加大型数据集时(例如从 JSON 端点接收的数据),可以在首先添加的数据的根上调用 `freeze(json)` ,来*浅冻结*它。这将允许 Immer 更快地将新数据添加到树中,因为它将避免*递归*扫描和冻结新数据的需要。7475### 您可以随时选择退出7677immer 在任何地方都是可选的,因此手动编写性能非常苛刻的 reducers ,并将 immer 用于所有普通的的 reducers 是非常好的。即使在 producer 内部,您也可以通过使用 `original` 或 `current` 函数来选择退出 Immer 的某些部分逻辑,并对纯 JavaScript 对象执行一些操作。
8 unmodified lines
modified:website/docusaurus.config.js+1 added-1 removed
modified:readme.md+1 added-1 removed
1<img src="images/immer-logo.svg" height="200px" align="right"/>23# Immer45[![npm](https://img.shields.io/npm/v/immer.svg)](https://www.npmjs.com/package/immer) [![Build Status](https://travis-ci.org/immerjs/immer.svg?branch=master)](https://travis-ci.org/immerjs/immer) [![Coverage Status](https://coveralls.io/repos/github/mweststrate/immer/badge.svg?branch=master)](https://coveralls.io/github/mweststrate/immer?branch=master) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![OpenCollective](https://opencollective.com/immer/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/immer/sponsors/badge.svg)](#sponsors) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/immerjs/immer)5[![npm](https://img.shields.io/npm/v/immer.svg)](https://www.npmjs.com/package/immer) [![Build Status](https://travis-ci.org/immerjs/immer.svg?branch=main)](https://travis-ci.org/immerjs/immer) [![Coverage Status](https://coveralls.io/repos/github/mweststrate/immer/badge.svg?branch=main)](https://coveralls.io/github/mweststrate/immer?branch=main) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![OpenCollective](https://opencollective.com/immer/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/immer/sponsors/badge.svg)](#sponsors) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/immerjs/immer)67_Create the next immutable state tree by simply modifying the current tree_89Winner of the "Breakthrough of the year" [React open source award](https://osawards.com/react/) and "Most impactful contribution" [JavaScript open source award](https://osawards.com/javascript/) in 2019
24 unmodified lines