You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+85-18Lines changed: 85 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,4 @@
1
+
1
2
# js-framework-benchmark
2
3
3
4
This is a simple benchmark for several javascript frameworks. The benchmarks creates a large table with randomized entries and measures the time for various operations including rendering duration.
@@ -43,30 +44,95 @@ The current snapshot that may not have the same quality (i.e.
43
44
results might be for mixed browser versions, number of runs per benchmark may vary) can be seen [here](https://rawgit.com/krausest/js-framework-benchmark/master/webdriver-ts-results/table.html)
#1 NEW + experimental: Run pre-built binaries for all frameworks
47
48
48
49
There are currently ~60 framework entries in this repository. Installing (and maintaining) those can be challenging, but here are simplified instructions how to get started.
49
50
50
-
### 1.1 Prerequisites
51
+
## 1.1 Prerequisites
52
+
53
+
Have _node.js (>=v16.14.2)_ installed. If you want to do yourself a favour use nvm for that and install yarn. The benchmark has been tested with node vv16.14.2.
54
+
Please make sure that the following command work before trying to build:
55
+
56
+
```
57
+
> npm
58
+
npm -version
59
+
8.5.0
60
+
> node --version
61
+
v16.14.2
62
+
```
63
+
64
+
## 1.2 Downloading the pre-built binaries and starting the server
65
+
Builiding all frameworks can be challenging. There's a new way that allows to skip that and just run the benchmark without builiding all implementationss.
66
+
67
+
68
+
Start with checking out a tagged release like that. Pick the release that you want (e.g. chrome 100):
Download the build.zip for that release from https://github.com/krausest/js-framework-benchmark/releases
76
+
and put the build.zip into the js-framework-benchmark directory and unzip the prebuilt files:
77
+
```
78
+
unzip build.zip
79
+
```
80
+
You're now ready to start the http-server. Let the server run in the background
81
+
```
82
+
npm start
83
+
```
84
+
## 1.3 Running the benchmarks and handling errors
85
+
86
+
In a new console window you can now run the benchmarks:
87
+
```
88
+
npm run bench
89
+
```
90
+
91
+
This will take some time (currently about 12 hours on my machine). Finally create the results table:
92
+
```
93
+
npm run results
94
+
```
95
+
96
+
Open js-framework-benchmark/webdriver-ts-results/table.html in a browser and take a look at the results. You can open the result table with the link [http://localhost:8080/webdriver-ts-results/table.html](http://localhost:8080/webdriver-ts-results/table.html)
51
97
52
-
Have _node.js (>=10.0)_ installed. If you want to do yourself a favour use nvm for that and install yarn. The benchmark has been tested with node v10.16.3.
98
+
99
+
Here's what you should do when the benchmark run was not sucessful. Let's assume the benchmark printed the following to the console:
100
+
```
101
+
================================
102
+
The following benchmarks failed:
103
+
================================
104
+
Executing frameworks/non-keyed/ef-js and benchmark 04_select1k failed: No paint event found
105
+
run was not completely sucessful Benchmarking failed with errors
106
+
```
107
+
You'll now have to run the benchmark again for those that failed like that:
108
+
```
109
+
npm run bench -- --framework non-keyed/ef-js --benchmark 04_
110
+
```
111
+
The you can then continue with creating the results table `npm run results`.
112
+
Another workaround is to delete the folders of frameworks you can't run or you are not interested in.
113
+
114
+
# 2 Building the frameworks and running the benchmark
115
+
116
+
## 2.1 Prerequisites
117
+
118
+
Have _node.js (>=v16.14.2)_ installed. If you want to do yourself a favour use nvm for that and install yarn. The benchmark has been tested with node vv16.14.2.
53
119
For some frameworks you'll also need _java_ (>=8, e.g. openjdk-8-jre on ubuntu).
54
120
Please make sure that the following command work before trying to build:
55
121
56
122
```
57
123
> npm
58
124
npm -version
59
-
5.0.0
125
+
8.5.0
60
126
> node --version
61
-
v8.0.0
127
+
v16.14.2
62
128
> echo %JAVA_HOME% / echo $JAVA_HOME
63
129
> java -version
64
130
java version "1.8.0_131" ...
65
131
> javac -version
66
132
javac 1.8.0_131
67
133
```
68
134
69
-
### 1.2 Start installing
135
+
##2.2 Start installing
70
136
71
137
As stated above building and running the benchmarks for all frameworks can be challenging, thus we start step by step...
72
138
@@ -114,7 +180,7 @@ There should be no build errors and we can open the framework in the browser:
114
180
115
181
Some frameworks like binding.scala or ember can't be opened that way, because they need a 'dist' or 'target/web/stage' or something in the URL. You can find out the correct URL in the [index.html](http://localhost:8080/index.html) you've opened before or take a look whether there's a customURL property under js-framework-benchmark in the [package.json](https://github.com/krausest/js-framework-benchmark/blob/master/frameworks/keyed/ember/package.json#L10) that represents the url.
116
182
117
-
### 1.4 Running benchmarks for a single framework
183
+
##2.3 Running benchmarks for a single framework
118
184
119
185
The benchmark uses an automated benchmark driver using chromedriver to measure the duration for each operation using chrome's timeline. Here are the steps to run is for a single framework:
120
186
@@ -163,7 +229,7 @@ npm run isKeyed keyed/vanillajs
163
229
164
230
If it finds anything it'll report an ERROR.
165
231
166
-
### 1.5 Building the result table
232
+
### 2.4 Building the result table
167
233
168
234
Install libraries:
169
235
@@ -185,15 +251,15 @@ Now a result table should have been created which can be opened on [http://local
185
251
There's nothing in table except for the column vanillajs-keyed at the right end of the first table.
186
252

187
253
188
-
### 1.6[Optional] Updating the index.html file
254
+
##2.4[Optional] Updating the index.html file
189
255
190
256
This simply rebuilds the file used to display the table, not the results.
191
257
192
258
```
193
259
npm run index
194
260
```
195
261
196
-
### 1.7[Optional] Building and running the benchmarks for all frameworks
262
+
##2.5[Optional] Building and running the benchmarks for all frameworks
197
263
198
264
This is not for the faint at heart. You can build all frameworks simply by issuing:
199
265
@@ -214,7 +280,7 @@ in the root directory.
214
280
215
281
After that you can check all results in [http://localhost:8080/webdriver-ts/table.html](http://localhost:8080/webdriver-ts/table.html).
216
282
217
-
### 1.8 Tips and tricks
283
+
#3 Tips and tricks
218
284
219
285
- You can run multiple implementations by passing their directory names (cd to webdriver-ts):
220
286
`npm run bench keyed/angular keyed/react`.
@@ -226,9 +292,9 @@ After that you can check all results in [http://localhost:8080/webdriver-ts/tabl
226
292
- If you can't get one framework to compile or run, just move it out of the frameworks directory and re-run
227
293
- One can check whether an implementation is keyed or non-keyed via `npm run isKeyed` in the webdriver-ts directory. You can limit which frameworks to check in the same way as the webdriver test runner like e.g. `npm run isKeyed keyed/svelte`. The program will report an error if a benchmark implementation is incorrectly classified.
228
294
229
-
## 2. Contributing a new implementation
295
+
## 4. Contributing a new implementation
230
296
231
-
### 2.1 Building the app
297
+
##4.1 Building the app
232
298
233
299
For contributions it is basically sufficient to create a new directory for your framework that supports `npm install` and `npm run build-prod` and can be then opened in the browser. All other steps are optional. Let's simulate that by copying vanillajs.
234
300
@@ -250,7 +316,7 @@ In most cases you'll need `npm install` and `npm run build-prod` and then check
250
316
251
317
(Of course in reality you'd rather throw out the javascript source files and use your framework there instead of only changing the html file.)
252
318
253
-
### 2.2 Adding your new implementation to the results table.
319
+
##4.2 Adding your new implementation to the results table.
254
320
255
321
(Notice: Updating common.ts is no longer necessary, super-vanillajs is visible in the result table)
256
322
@@ -286,7 +352,7 @@ The other important, but optional properties for js-framework-benchmark are show
286
352
287
353
You can set an optional different URL if needed or specify that your DOM uses a shadow root.
288
354
289
-
### 2.3 Submitting your framework
355
+
##4.3 Submitting your implementation
290
356
291
357
Contributions are very welcome. Please use the following rules:
292
358
@@ -323,15 +389,15 @@ This work is derived from a benchmark that Richard Ayotte published on https://g
323
389
324
390
Thanks to Baptiste Augrain for making the benchmarks more sophisticated and adding frameworks.
325
391
326
-
##History
392
+
# History
327
393
328
394
Frameworks without significant activity on github or npm for more than a year will be removed (_automatic commits like dependabot and minor updates, like docs editions, are ignored_).
329
395
330
396
Will be removed in future:
331
397
332
398
-[ ] crui Last significant commit Jul 28, 2019
333
399
334
-
###2020-7-9
400
+
## 2020-7-9
335
401
336
402
-[x] etch Last commit Sep 12, 2018
337
403
-[x] hyperoop Last significant commit Dec 23, 2018
0 commit comments