three.js闪电效果_什么是闪电般快速应用的最佳js框架

three.js闪电效果

During the past few months, I have been studying various JavaScript frameworks and their differences. I realized that there is a large number of frameworks in the JavaScript world, and each one brings its own unique qualities. I have done a few comparisons about some of these frameworks in the past, but in this article, I’m going to pick three and discuss the best framework to build a lightning-fast web application.

在过去的几个月中,我一直在研究各种JavaScript框架及其差异。 我意识到JavaScript世界中有很多框架,并且每个框架都有其独特的品质。 过去,我已经对其中一些框架进行了一些比较 ,但是在本文中,我将选择三个框架,并讨论构建闪电般的Web应用程序的最佳框架。

I have picked React, which is a very famous framework, alongside Preact and Inferno. I will talk about the features of these frameworks that enable us to develop fast web applications, their advantages, disadvantages, statistical proof, and some other interesting facts that will help you to choose the best framework for your project.

我选择了React,这是一个非常著名的框架,与PreactInferno一起。 我将讨论这些框架的功能,这些功能使我们能够开发快速的Web应用程序,它们的优缺点,统计证明以及其他一些有趣的事实,这些事实将帮助您为项目选择最佳的框架。

事前 (Preact)

Preact claims to one of the most lightweight frameworks in the context with a size of 3kB. Being small in size hasn’t limited its performance. It is considered a very powerful framework and is a front-line competitor to React.

Preact声称是上下文中最轻量级的框架之一,大小为3kB。 体积小并没有限制其性能。 它被认为是一个非常强大的框架,并且是React的一线竞争对手。

When we compare Preact to React, we can see that there are several similarities between them. But I can assure you that there are far more important differences since Preact is mainly based on speed and performance. Here are some of the major features of Preact that make it faster than React:

将Preact与React进行比较时,我们可以发现它们之间存在一些相似之处。 但我可以向您保证,由于Preact主要基于速度和性能,因此还有更多重要的区别。 以下是Preact的一些主要功能,这些功能使其比React更快:

  • First of all, its size is around 3Kb when Gzipped. React is about 42KB when Gzipped.

    首先,压缩后其大小约为3Kb。 压缩后,React约为42KB。
  • While React contains its own synthetic event system that contains a variety of benefits, it is considered very heavy. Preact only uses DOM APIs to fulfill the duties of a synthetic event system.

    尽管React包含其自己的综合事件系统,该系统具有多种好处,但它被认为非常繁重。 Preact仅使用DOM API来履行合成事件系统的职责。
  • Preact contains more features than React-lite, which is a lighter version of React.

    Preact比React-lite(React的简化版本)包含更多功能。
  • Preact is obviously faster than React. I found this cool speed comparison mechanism that is hosted as a GitHub site. It can compare framework speed by adding, completing, and deleting 100 items. So I ran the benchmark test from that, and the result showed that Preact is almost four times faster than React.

    Preact显然比React快。 我发现了这个很棒的速度比较机制,该机制作为GitHub站点托管。 它可以通过添加,完成和删除100个项目来比较框架速度。 因此,我从中进行了基准测试,结果表明Preact比React快四倍。

Image for post
TodoMVC Benchmark TodoMVC Benchmark

Also, it is quite easy to work with Preact if you are familiar with React since it is largely compatible with React. Other than that, there are several significant advantages of using Preact:

另外,如果您熟悉React,则与Preact一起使用非常容易,因为它与React很大程度上兼容。 除此之外,使用Preact还有几个重要的优点:

  • It supports ES6 API (same as React).

    它支持ES6 API(与React相同)。
  • Powerful CLI enables quick project setup

    强大的CLI支持快速的项目设置
  • Contains additional advanced features unique to React.

    包含React独有的其他高级功能。
  • Since Preact is growing rapidly, there are many examples, a lot of documentation, a growing community, etc.

    由于PreactSwift发展,因此有许多示例,大量文档,社区在不断发展,等等。

Although Preact contains many features, there are several drawbacks to it as well. However, Preact is still a better option than React if you need to build a small-scale performance-based application.

尽管Preact包含许多功能,但也有一些缺点。 但是,如果您需要构建基于性能的小型应用程序,那么Preact仍然是比React更好的选择。

地狱 (Inferno)

Inferno is another JavaScript UI library that is almost similar to React. Similarly to Preact, Inferno is also built on the same API as React, but the main intention behind Inferno is to be fast and lightweight. Although Inferno is based on React, it contains some significant features/differences compared to React to Preact:

Inferno是另一个JavaScript UI库,几乎类似于React。 与Preact相似,Inferno也使用与React相同的API构建,但是Inferno的主要目的是快速,轻便。 尽管Inferno基于React,但与React to Preact相比,它包含一些重要的功能/差异:

  • When compared to React, Inferno is very tiny in size. It is around 8KB when Gzipped, so slightly larger than Preact.

    与React相比,Inferno的体积非常小。 压缩后约为8KB,因此比Preact稍大。
  • Inferno does not contain a DOM separately. Inferno’s DOM is built into its core.

    Inferno不单独包含DOM。 Inferno的DOM内置于其核心中。
  • Inferno-compact gives the ability to work with a large variety of React libraries.

    Inferno-compact使您可以使用各种React库。
  • Inferno has lifecycle methods on functional components.

    Inferno具有功能组件的生命周期方法。

Since this article is mainly based on speed and performance, let’s look into a benchmark comparison provided by Interno itself about a few JS frameworks.

由于本文主要基于速度和性能,因此让我们看一下Interno本身提供的关于一些JS框架的基准比较。

Image for post
Inferno 地狱

As you can see, Inferno’s benchmark values for typical app operations are higher than those of both Preact and React. They are almost similar to those of Vanilla JS. You can find more details on this benchmark system on GitHub.

如您所见,Inferno对于典型应用程序操作的基准值高于Preact和React的基准值。 它们几乎与Vanilla JS相似。 您可以在GitHub上找到有关此基准测试系统的更多详细信息。

Here are a few other advantages of using Inferno:

以下是使用Inferno的其他一些优点:

  • It is insanely fast.

    速度很快。
  • Lighter than React, Angular, and Vue.

    比React,Angular和Vue轻。
  • Inferno contains its own server-side rendering and routing features.

    Inferno包含其自己的服务器端呈现和路由功能。
  • You can use regular styling properties with Inferno styling.

    您可以将常规样式属性与Inferno样式一起使用。
  • You can build an application with your own architecture rather than limiting it to someone else’s designs.

    您可以使用自己的体系结构来构建应用程序,而不是将其限制于其他人的设计。

On the other hand, there are some significant drawbacks as well. Since Inferno is relatively new compared to React, its ecosystem and community are still growing. So, it will take significant time to come up with additional libraries, support, etc.

另一方面,也存在一些明显的缺点。 由于与React相比,Inferno相对较新,因此其生态系统和社区仍在增长。 因此,将需要大量时间来提供其他库,支持等。

Also, there is no support for Hooks in Inferno either. Although you can use inferno-compact to use React components or packages, it will make the project slower and larger in size. As a result, you will lose the main benefit of using Inferno.

同样,Inferno也没有对Hooks的支持。 尽管您可以使用inferno-compact来使用React组件或包,但是这会使项目变慢并且变大。 结果,您将失去使用Inferno的主要好处。

结论 (Conclusion)

As the topic of this article states, the main intention was to compare the speed of the React, Preact, and Inferno frameworks. We can clearly see that Preact and Inferno are similar to React and most of their features are based on React as well. But when it comes to speed and performance, Preact is on the top, while Inferno sits in second place.

正如本文的主题所述,主要目的是比较React,Preact和Inferno框架的速度。 我们可以清楚地看到Preact和Inferno与React类似,它们的大多数功能也基于React。 但是在速度和性能方面,Preact居首位,而Inferno则位居第二。

So, if you are seeking a React-like framework for a small-scale platform that requires lightning-fast performance, Preact or Inferno will be a good option for you. But you must always keep in mind that we can’t match the features of React with Preact or Inferno completely since React is an established framework that has almost taken over Angular as well.

因此,如果您正在为需要闪电般性能的小型平台寻找类似React的框架,Preact或Inferno将是您的理想选择。 但您必须始终牢记,由于React是已经几乎取代了Angular的既定框架,因此我们无法将React与Preact或Inferno的功能完全匹配。

React is still on the top when it comes to features and native support, while Preact and Inferno have the advantage in speed.

在功能和本机支持方面,React仍然位居榜首,而Preact和Inferno在速度方面具有优势。

翻译自: https://medium.com/better-programming/whats-the-best-js-framework-for-lightning-fast-applications-a3e4c201ec62

three.js闪电效果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值