ngrx 和 ngxs 之间的性能差异?
Difference in performance between ngrx and ngxs?
我想在我的 Angular 6 应用程序中使用 ngxs 进行状态管理。
但我不确定它是否适合大项目。
我找不到任何关于 ngrx 和 ngxs 性能差异的文章。
有人可以提供一些相关信息吗?
性能指标:从商店获取大量项目并写回商店。
根据我的经验,NGXS 编写起来更简单,并且更容易处理延迟加载状态。它具有如此简单的语法,它是 OOP,而不是 Redux FP 范式。装饰你的动作和选择器,订阅记忆状态,在任何地方捕捉调度的动作,等等。
但是,当涉及到存储插件时,我发现了一个陷阱,它本质上是用于离线优先应用程序。它使用限制为 5MB 的同步本地存储,并在需要将大数据写入存储时停止 UI。但是,您可以在插件之上编写自定义存储解决方案。它是可扩展的,可扩展的,您可以轻而易举地注入 util 类,文档尽可能简单。
这是来自 Reddit (Angular2+ community) 的好回答。它来自测试了两者并切换到 NGXS 的开发人员。
I would like to share my experience. We have a medium-large enterprise
app. We started with NGRX, but it quickly became clear that
NGRX code is much difficult to understand and write to teammates.
NGRX is boilerplate hell. You spend lot of time with it.
The concept of "Effects" is good, but it just adds extra layers of
complexity which could be simplified.
Developer Experience (DX) was horrifying.
Then we switched to NGXS.
It has minimum boilerplate. You jump right into "action" :D.
We were delighted by its DX.
It is much easier to understand for teammates and everybody was
suddenly productive.
There are some tradeoffs like server calls are in reducers, but it
made sense to use after a while.
PLUGINS! There are loads of plugins from logging to forms handling
(Awesome thing ever).
我最近遇到了 NGRX 的问题,因为我必须分派两个动作,但第二个动作取决于第一个动作的成功,问题是 Reducers 运行 异步,第二个动作结束在第一个没有完成的情况下,尝试用 Effects 解决它,但即使在那里也发生了同样的事情。使用 NGXS 我可以解决它,因为 Dispacher returns 是在操作结束时可观察到的。
总的来说,NGXS 运行得很好,性能也很相似,我不得不在一个有多个嵌套级别的架构中更新大量数据,而且更新时间似乎没有差异。
我想在我的 Angular 6 应用程序中使用 ngxs 进行状态管理。
但我不确定它是否适合大项目。
我找不到任何关于 ngrx 和 ngxs 性能差异的文章。 有人可以提供一些相关信息吗?
性能指标:从商店获取大量项目并写回商店。
根据我的经验,NGXS 编写起来更简单,并且更容易处理延迟加载状态。它具有如此简单的语法,它是 OOP,而不是 Redux FP 范式。装饰你的动作和选择器,订阅记忆状态,在任何地方捕捉调度的动作,等等。
但是,当涉及到存储插件时,我发现了一个陷阱,它本质上是用于离线优先应用程序。它使用限制为 5MB 的同步本地存储,并在需要将大数据写入存储时停止 UI。但是,您可以在插件之上编写自定义存储解决方案。它是可扩展的,可扩展的,您可以轻而易举地注入 util 类,文档尽可能简单。
这是来自 Reddit (Angular2+ community) 的好回答。它来自测试了两者并切换到 NGXS 的开发人员。
I would like to share my experience. We have a medium-large enterprise app. We started with NGRX, but it quickly became clear that
NGRX code is much difficult to understand and write to teammates.
NGRX is boilerplate hell. You spend lot of time with it.
The concept of "Effects" is good, but it just adds extra layers of complexity which could be simplified.
Developer Experience (DX) was horrifying.
Then we switched to NGXS.
It has minimum boilerplate. You jump right into "action" :D.
We were delighted by its DX.
It is much easier to understand for teammates and everybody was suddenly productive.
There are some tradeoffs like server calls are in reducers, but it made sense to use after a while.
PLUGINS! There are loads of plugins from logging to forms handling (Awesome thing ever).
我最近遇到了 NGRX 的问题,因为我必须分派两个动作,但第二个动作取决于第一个动作的成功,问题是 Reducers 运行 异步,第二个动作结束在第一个没有完成的情况下,尝试用 Effects 解决它,但即使在那里也发生了同样的事情。使用 NGXS 我可以解决它,因为 Dispacher returns 是在操作结束时可观察到的。
总的来说,NGXS 运行得很好,性能也很相似,我不得不在一个有多个嵌套级别的架构中更新大量数据,而且更新时间似乎没有差异。