Angular 4 vs React表现 - 理论与现实

时间:2017-07-06 08:47:57

标签: javascript performance angular reactjs jit

这基本上是相同的旧版x vs y, what is faster?,但我希望我的版本适用。另外,React和Angular有点不同,比如GTK和Qt(甚至更多),比较它们是愚蠢的 - 一个是开箱即用的可以做任何东西的框架,而另一个是View框架,只设计那。如果我的问题仍然是无法回答或主观的,应该关闭,如果可能的话,请写下我将来如何改进它的评论。谢谢。

这是关于Angular 2+ vs React在性能方面的问题。我的团队应为每个框架构建一个具有相同功能的SPA。

假设:

  • 两个版本的开发时间应相等/相似
  • 非视图相关功能(Angular与仅视图React不同)对测量和开发时间不重要,视图更新频繁发生并且是瓶颈
  • 测量的是初始页面加载后的稳态性能(因此页面的所有数据都在内存中)
  • 这两个应用程序都是按相关手册推荐的方式构建的
  • 仅客户端呈现,主要是动态数据(因此服务器端呈现不足或提前编译)

Javascript虚拟机难以推理,但我的两个问题正是他们的行为:

  1. 在当前的JIT已经完成其工作(尽可能优化)或最终表现是否相等之后,会有明显的表现赢家吗?
  2. 在2027年,我们仍将使用网络浏览器(可能是Chrome 256或Firefox 384)。假设两个框架仍然存在,并保持其核心战略/机制与今天相同。浏览器Javascript VMs / JIT进一步改进,但我保留了当前的笔记本电脑来衡量性能。哪个框架可能在2027年获胜?或者重新解释一个问题:哪种策略在理论上更优化/'更接近金属'(或者在这种情况下:更接近Javascript执行模型)?
  3. PS:我很确定在2027年我们也不会使用它们,这个问题也不是关于任何人应该选择的框架,而只是理论性能。关于哪个框架“更接近金属”的问题在一天晚上与朋友们提出,不应该被任何人用来做出决定。永远不要在醉酒或深夜做出重要的生活决定。

1 个答案:

答案 0 :(得分:0)

My experience but not the final decision

I started with Angular and wanted to see what React could do. React is certainly not bad, but what I immediately noticed was the disorder that can prevail. That depends on the developer, of course, but with Angular and TypeScript everything looks more orderly and structured. Template and code are separated and with React you have the JSX, i.e. HTML in JavaScript which is JavaScript. Reminds me a bit of PHP and I never liked that, because when a project gets extremely big, you really lose track. For one component you could easily have 3-5 files and that is bad in my opinion. With Angular you can also lose the overview, but you have a uniform structure with a few deviations.

If your application becomes really very very big then it makes sense to use Redux but why people making life complicated. If you just want to check if a user logged in or not for a middle large e-commerce site then services would also do the job.

In my opinion, the user should focus on working. Redux it is fine but we should not add every new tool which comes each week to our project either is reduce cost and time dramatically. But if you add new tools then you should also have people who can handle it later. It doesn't mean if you use every tool that your application is good or you are a good developer automatically. In my opinion, keep everything as simple as possible and use the tools you really need to fulfill your requirements.

And by the way I don't understand why the people still want to use Vaadin, Spring Boot together with Angular in combination. Maybe someone can explain it me?