參考框架 系統 基準_帶有基準的前端框架的實際比較

參考框架 系統 基準

by Jacek Schae

由Jacek Schae

帶有基準的前端框架的實際比較 (A Real-World Comparison of Front-End Frameworks with Benchmarks)

UPDATE: There is a newer version of this article

更新:本文有較新的版本

A Real-World Comparison of Front-End Frameworks with Benchmarks (2018 update)This article is a refresh of A Real-World Comparison of Front-End Frameworks with Benchmarks from December 2017.medium.freecodecamp.org

帶有基準的前端框架的實際比較(2018年更新) 本文是2017年12月以來的帶有基準的前端框架的實際比較的更新 。medium.freecodecamp.org

Over the last couple of years we have seen an explosion of front-end frameworks. Each one of them is more than capable of building great web applications. So how do you compare and decide which one to use for your next project?

在過去的幾年中,我們看到了前端框架的爆炸式增長。 他們每個人都具有構建出色的Web應用程序的能力。 那么,您如何比較并決定在下一個項目中使用哪個?

First of all, to make a meaningful comparison we need a few things:

首先,要進行有意義的比較,我們需要注意以下幾點:

  1. Real World App - Something more than a “todo”. Usually “todos” don’t convey knowledge & perspective to actually build real applications.

    真實世界的應用程序 -不僅僅是“待辦事項”。 通常,“待辦事項”不會傳達知識和觀點來實際構建實際的應用程序。

  2. Standardized - A project that conforms to certain rules. Hosted at the same place, provides a back-end API, static markup, styles, and spec.

    標準化 -符合某些規則的項目。 托管在同一位置,提供了后端API,靜態標記,樣式和規范。

  3. Written by an expert - A consistent, real world project, that ideally an expert in that technology would have built. This is true, at least most of the time (see below).

    由專家撰寫 -一個一致的,真實世界的項目,理想情況下,該技術的專家應會建立。 至少在大多數情況下都是如此(請參閱下文)。

So how do we get such a project? The good news is that Eric Simons already created a RealWorld project. It’s a clone of the Medium blogging platform. Each implementation of this project uses the same HTML structure, CSS, and API spec, but a different library/framework. When it comes to expert knowledge it’s true most of the time. I wrote an implementation in ClojureScript and re-frame and I don’t consider myself an expert. In my defense an expert reviewed my code - thanks Daniel Compton.

那么我們如何獲得這樣的項目呢? 好消息是Eric Simons已經創建了一個RealWorld項目。 它是Medium博客平臺的克隆。 該項目的每個實現都使用相同HTML結構,CSS和API規范,但使用不同的庫/框架。 當涉及到專家知識時,大多數時候都是如此。 我用ClojureScript編寫了一個實現并重新設計框架 ,但我不認為自己是專家。 在我的辯護中,一位專家檢查了我的代碼-謝謝Daniel Compton 。

Now we have a baseline spec, we need a standard set of tests/metrics to compare them.

現在我們有了基準規范,我們需要一組標準的測試/指標來進行比較。

  1. Performance. How long does this App take to show content and become usable?

    性能。 此應用需要多長時間才能顯示內容并可用?

  2. Size. How big is the App? We will only compare the size of the compiled JavaScript. The CSS is common to all variants, and is downloaded from a CDN (Content Delivery Network). The HTML is common to all variants too. All technologies compile or transpile to JavaScript, thus we only size this file.

    尺寸。 該應用程序有多大? 我們將僅比較已編譯JavaScript的大小。 CSS對于所有變體都是通用的,并且是從CDN(內容交付網絡)下載的。 HTML對于所有變體也是通用的。 所有技術都可以編譯或轉換為JavaScript,因此我們僅調整該文件的大小。

  3. Lines of Code. How many lines of code did the author need to create RealWorld app based on spec? To be fair some apps have a bit more bells and whistles, but it should not have a significant impact. The only folder we quantify is src/ in each app.

    代碼行。 作者需要多少行代碼才能根據規范創建RealWorld應用程序? 公平地講,某些應用程序有很多麻煩,但應該不會產生重大影響。 我們量化的唯一文件夾是每個應用程序中的src /。

At the time of writing (Dec 2017) the RealWorld project is available in the following frameworks:

在撰寫本文時(2017年12月),RealWorld項目在以下框架中可用:

  • React / Redux

    React / Redux

  • Elm

    榆樹

  • Angular 4+

    角4+

  • Angular 1.5+

    角度1.5+

  • React / MobX

    React / MobX

  • Crizmas MVC

    Crizmas MVC

  • CLSJ Keechma

    CLSJ Keechma

  • AppRun

    AppRun

  • CLJS re-frame (This is the one I did. It’s not yet listed at RealWorld Project).

    CLJS重新構圖 (這是我所做的。它尚未在RealWorld Project中列出)。

指標1:效果 (Metric 1: Performance)

First meaningful paint test with Lighthouse Audit that ships with Chrome.

Chrome隨附的Lighthouse Lighthouse進行了 首次有意義的油漆測試。

The sooner you paint, the better the experience for the person who is using the App. Lighthouse also measures First interactive, but this was almost identical for most apps.

涂漆越早,使用該應用程序的人的體驗就越好。 Lighthouse還可以測量First Interactive ,但這對于大多數應用程序幾乎相同。

指標2:大小 (Metric 2: Size)

Transfer size is from the Chrome network tab. GZIPed response headers plus the response body, as delivered by the server.

傳輸大小來自Chrome網絡標簽。 服務器提供的GZIPed響應標頭以及響應正文。

Smaller file = faster download and less to parse.

較小的文件=下載速度更快,而且解析次數更少。

This depends on the size of your framework, any extra dependencies you added, and how well your build tool can make a small bundle.

這取決于框架的大小,所添加的任何其他依賴項以及您的構建工具可以制作小捆綁包的能力。

指標3:代碼行 (Metric 3: Lines of Code)

Using cloc we count lines of code in each repo’s src folder. Blank and comment lines are not part of this calculation.Why is this meaningful?

使用cloc,我們計算每個倉庫的src文件夾中的代碼行數。 空白和注釋行不是此計算的一部分。為什么這有意義?

If debugging is the process of removing software bugs, then programming must be the process of putting them in - Edsger Dijkstra
如果調試是消除軟件錯誤的過程,則編程必須是將其放入程序的過程-Edsger Dijkstra

The fewer lines of code you have the smaller probability of an error and smaller code base to maintain.

代碼行越少,出錯的可能性就越小,要維護的代碼庫也就越少。

結論 (Conclusion)

性能 (Performance)

This is a RealWorld Comparison and not a benchmark in a vacuum. Tests were performed out of Europe (Switzerland). All Apps were hosted on Github. Values may differ for you, which is fine. Tests were performed couple of times for each app, then averaged, and rounded. Results were pretty linear when comparing throughout the day. Most of the libraries/frameworks are in the range of excellent and good. You won’t see a lot of difference when it comes to performance.

這是真實世界的比較,而不是基準測試。 測試是在歐洲(瑞士)以外進行的。 所有應用都托管在Github上。 值可能對您有所不同,這很好。 對每個應用程序進行了兩次測試,然后取平均值并四舍五入。 全天比較時,結果呈線性關系。 大多數庫/框架都在優秀和優秀范圍內。 在性能方面,您不會看到太多差異。

尺寸 (Size)

The bundle size for each App is always the same. We are comparing similar implementations and look at how bundle sizes differ. AppRun is insane! I looked a couple of times because I couldn’t believe it. Elm is doing an amazing job when it comes to bundle size and especially when you look at lines of code.

每個應用程序的捆綁包大小始終相同。 我們正在比較類似的實現,并查看包大小如何不同。 AppRun太瘋狂了! 我看了幾次,因為我簡直不敢相信。 在包大小方面,尤其是當您查看代碼行時,Elm做得非常出色。

代碼行 (Lines of code)

This has the biggest impact on you as a software developer. The more lines of code, the more you need to type and more to maintain. There are some trade offs here. Especially when it comes to typed vs. dynamic languages. Types give you more safety and come at a cost - more things to type.

作為軟件開發人員,這對您影響最大。 代碼行越多,您需要鍵入的內容就越多,需要維護的內容也就越多。 這里有些折衷。 尤其是當涉及到打字語言還是動態語言時。 類型為您提供更多的安全性,而且要付出一定的代價-要打字的東西更多。

輸入與動態 (Typed vs. dynamic)

Typed: Elm, Angular 4+ and AppRun.

鍵入 :Elm,Angular 4+和AppRun。

Dynamic: React | Redux, Angular 1.5, React | MobX, Crizmas MVC, CLJS Keechma, and CLJS re-frame.

動態 :React | Redux,Angular 1.5,React | MobX,Crizmas MVC,CLJS Keechma和CLJS重新構架。

So which is better? It’s not better or worse, it’s different. Like TDD (Test Driven Development), some people love it, some hate it. You can develop great software with or without it - pick the one that fits you better.

那么哪個更好呢? 它不是好是壞,這是不同的。 就像TDD(測試驅動開發)一樣,有些人喜歡它,有些討厭它。 無論有無軟件,您都可以開發出色的軟件-選擇更適合您的軟件。

Vue,Preact,Ember,Svelte,Aurelia等在哪里? (Where are Vue, Preact, Ember, Svelte, Aurelia and others?)

Seems like they are late to the party, but worry not. I’ll do another round when we have them. There are already open issues - consider contributing! Or start from scratch and open a new issue.

好像他們遲到了聚會,但不用擔心。 有空的時候我再做一輪。 已經存在未解決的問題 -請考慮做出貢獻! 或從頭開始并打開一個新問題。

最后的話 (Final word)

This comparison is exactly what it says. Compares different implementations of similar real world web applications in a real world. I know, it’s not perfect. It differs based on server load, network traffic, and many other things that happen in the real world.

這種比較正是它所說的。 比較現實世界中類似現實世界Web應用程序的不同實現。 我知道,這并不完美。 它根據服務器負載,網絡流量以及現實世界中發生的許多其他事件而有所不同。

Thanks to Daniel Compton for proof-reading.

感謝Daniel Compton的校對。

If you enjoyed this article, and would like to be notified when I release similar article consider following me on medium and twitter.

如果您喜歡這篇文章,并且希望在我發布類似文章時收到通知,請考慮在medium和twitter上關注我。

翻譯自: https://www.freecodecamp.org/news/a-real-world-comparison-of-front-end-frameworks-with-benchmarks-e1cb62fd526c/

參考框架 系統 基準

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/395028.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/395028.shtml
英文地址,請注明出處:http://en.pswp.cn/news/395028.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

ppt復制切片器_零基礎小白自學PPT快速入門到精通(上)

零基礎小白如何自學PPT快速入門到精通呢?40個保姆級小技巧助力你高效掌握PPT基礎操作!PPT在學習與工作中的應用越來越廣泛:在學校時免不了要做畢業答辯、畢業論文,工作中時常要進行復盤總結、工作匯報、推廣方案,有時甚…

網絡安全初創公司SafeBreach獲1500萬美元A輪融資

今天,網絡安全初創公司 SafeBreach 宣布完成1500 萬美元 A 輪融資,新投資者德國電信、惠普公司、 Maverick Ventures 及現有投資者 Sequoia Capital 和 Shlomo Kramer 參投。公司計劃利用本輪融資加大研發力度,擴大銷售及營銷團隊&#xff0c…

php網站分區,PHP - Manual: 分區和分片 (官方文檔)

分區和分片數據庫群組是由于各種各樣的原因建立的,他可以提升處理能力、容忍錯誤,并且提升大量服務器同時工作的的性能。群組有時會組合分區和共享功能,來將大量復雜的任務分拆成更加簡單的任務,更加可控的單元。插件可以支持各種…

webBroser獲取cookie

//取當前webBrowser登錄后的Cookie值 [DllImport("wininet.dll", CharSet CharSet.Auto, SetLastError true)]static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref int pcchCookieData, int dwFlags…

了解Linux操作系統發展階段

一、硬件與軟件發展歷史 計算機由硬件和軟件組成結構 二、Linux的發展史 Linux 操作系統是Unix操作系統的一種克隆系統。它誕生于1991年的10月5日(只是第一次正式向外公布的時間)。以后借助于Internet網絡,并經過全世界各地計算機愛好者的共同…

c gui qt 4編程第二版_面試官問Linux下如何編譯C程序,如何回答?為你編譯演示

文章來源:嵌入式大雜燴 作者:ZhengNLWindows下常用IDE來編譯,Linux下直接使用gcc來編譯,編譯過程是Linux嵌入式編程的基礎,也是嵌入式高頻基礎面試問題。一、命令行編譯及各個細分編譯過程hello.c示例代碼:…

Python基礎-----列表、元組、集合(2)

raw_input ##字符類型input##數值類型##格式化輸出注釋切片s[2:5]##切片從2開始到5,不包括5[kioskfoundation39 mnt]$ pythonPython 2.7.5 (default, Oct 11 2015, 17:47:16) [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2Type "help", "copyri…

調用lambda_如何使用Lambda調用上下文動態設置超時

調用lambdaby Yan Cui崔燕 如何使用Lambda調用上下文動態設置超時 (How to set timeouts dynamically using Lambda invocation context) With API Gateway and Lambda, you’re forced to use short timeouts on the server-side:使用API?? Gateway和Lambda,您不…

php+tp框架+API,php - tp框架能開發API接口嗎

怪我咯2017-04-10 17:12:231樓TP的controller其實有很多種的HproseController,JsonRpcController,RestController,RpcController,YarController我拿RestController給你介紹一下RESTFul方法的操作方法定義主要區別在于,需要對請求類型和資源類型進行判斷,…

OTL翻譯(9) --常量的SQL語句

常量的SQL語句 一個沒有綁定變量的SQL語句、SQL語句塊或是存儲過程就被稱為常量的SQL語句。OTL通過一個靜態的函數來執行這樣的SQL語句。 例如: // static otl_cursor::direct_exec()otl_cursor::direct_exec(db, // connect object"create table test_tab(f1 …

[HNOI2016]網絡 樹鏈剖分,堆

[HNOI2016]網絡 LG傳送門 表示亂搞比正解難想。 整體二分很好想吧。 但是為了好寫快樂,我們選擇三個\(\log\)的亂搞。 先樹剖,線段樹套堆維護區間最大值。對于一次修改,如果是插入,就把樹上除了這條鏈的地方加上這個重要度&#x…

python壓縮文件為zip-python 壓縮文件為zip后刪除原文件

壓縮.log 文件為zip后刪除原文件 需要注意:本人作為小白,該腳本需要和.log在一起,后面有時間需要改正。 #!/usr/local/python/bin/python #-*-codingutf8 -*- import time import os import sys import zipfile N 7 #設置刪除多少天前的文件…

css text-align-last設置末尾文本對齊方式

text-align-last:auto | start | end | left | right | center | justify auto: 無特殊對齊方式。 left: 內容左對齊。 center: 內容居中對齊。 right: 內容右對齊。 justify: 內容兩端對齊。 start&#x…

后端開發除了編碼還要做什么_每個開發人員都應掌握的基本技能(除了編碼)

后端開發除了編碼還要做什么Whether you are learning to code, looking for a new job, or just want to improve your skills as a developer, you need to master the essential tools of team collaboration. These are as important as knowing how to code.無論您是學習編…

Python中的defaultdict方法

字典(dictionary)是Python中一種常用的數據類型。不同于其他由數字索引的序列,字典是用"鍵"(key)來索引的。通常表示為dict(key: val, ...),有以下特征: 鍵可以是任何不可變&#xff…

git撤銷commit 并保存之前的修改

撤銷并保留修改 參數 –soft # 先進行commit &#xff0c;之后后悔啦$ git commit -am "對首篇報告研究員字段改為author_name"執行git log $ git logcommit 3d6788f577faba5e1d408e372031c81beee79749Author: yous <yous.com>Date: Thu Dec 14 10:08:36 2017 …

php替換中文,PHP中文替換

//定義編碼header( Content-Type:text/html;charsetutf-8 );$wordsarray(我,你,他);$content"測一測我是不是違禁詞";$bannedgenerateRegularExpression($words);//檢查違禁詞$res_bannedcheck_words($banned,$content);write_html($content,$res_banned);/*** descr…

secoclient隧道保活超時或協商超時_推薦:承德市隧道led大屏廠家電話【聯豐智慧科技】...

通過為大型隧道施工建設搭建全覆蓋式的定位&#xff0c;可以有效施工的效率、項目現場的保障能力。安裝隧道門禁能解決哪些問題&#xff1f;近年來&#xff0c;我國交通建設正處于高速發展的階段&#xff0c;在交通建設中&#xff0c;工程安防工作也越發受到&#xff0c;越來越…

JavaScript Essentials:如何為循環而煩惱

by Zell Liew由Zell Liew JavaScript Essentials&#xff1a;如何為循環而煩惱 (JavaScript Essentials: how to wrap your head around for loops) Let’s say you want to run a function, bounceBall, four times. How would you do it? Like this?假設您要運行一次功能b…

python中的類的成員變量以及property函數

1 python類的各種變量 1.1 全局變量 在類外定義的變量。 1.2 類變量 定義在類里面&#xff0c;所有的函數外面的變量。這個變量只有一份&#xff0c;是所有的對象共有的。在類外用“類.”來引用。 1.3 實例變量 用self.xxx在類的任何函數中定義的變量就是實例變量。在類內用“s…