Skip to content

Commit f21c6e6

Browse files
committed
parametric yew path
1 parent 8fd6c84 commit f21c6e6

File tree

3 files changed

+15
-123
lines changed

3 files changed

+15
-123
lines changed

README.md

Lines changed: 9 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ There are 3 framework entries in this repository:
3737
* `keyed/yew`
3838
* `keyed/yew-baseline` _(Used to determine if recent changes improved performance)_
3939

40-
### 1. Prerequisites
40+
### Prerequisites
41+
42+
#### Install Node
4143

4244
Have *node.js (>=10.0)* installed. We recommend using `nvm` to manage node versions The benchmark has been tested with node v12.16.2.
4345
Please make sure that the following command work before trying to build:
@@ -51,136 +53,23 @@ v12.16.2
5153
v12.16.2
5254
```
5355

54-
### Install `chromedriver`
56+
#### Install `chromedriver`
5557

5658
https://chromedriver.chromium.org/downloads
5759

5860

59-
### Setup local server
60-
61-
You can use any server which properly handles the MIME type of wasm files. We recommend the `https` crate:
61+
#### Install local server
6262

6363
```
6464
cargo install https
6565
```
6666

67-
Start server in the root directory
68-
```
69-
http -p 8080
70-
```
71-
72-
Verify that the server works:
73-
Try to open [http://localhost:8080/index.html](http://localhost:8080/index.html). If you see something like that you're on the right track:
74-
![Index.html](images/index.png?raw=true "Index.html")
75-
76-
Now open a new terminal window and keep `http` running in background.
77-
78-
### 2. Building and running a single framework
79-
80-
We now try to build a framework. Go to the `wasm-bindgen` reference implementation
81-
```
82-
cd frameworks/keyed/wasm-bindgen
83-
```
84-
and install the dependencies
85-
```
86-
npm install
87-
```
88-
and build the framework
89-
```
90-
npm run build-prod
91-
```
92-
There should be no build errors and we can open the framework in the browser:
93-
[http://localhost:8080/frameworks/keyed/wasm-bindgen/index.html](http://localhost:8080/frameworks/keyed/wasm-bindgen/index.html)
94-
95-
## 3. Running a single framework with the automated benchmark driver
96-
97-
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 for a single framework:
67+
Make sure port `8080` is not taken.
9868

9969
### Run benchmarks
10070

101-
First, navigate to the `webdriver-ts/` directory.
102-
103-
and install the dependencies
104-
```
105-
npm install
106-
```
107-
and build the benchmark driver
108-
```
109-
npm run build-prod
110-
```
111-
now run the benchmark driver for the "wasmbindgen-keyed" framework:
112-
```
113-
npm run bench -- --headless keyed/wasm-bindgen
114-
```
115-
Just lean back and wait for chrome to run the benchmarks.
116-
Keep an eye on the console output to see if benchmark checks are timing out. If so, visit [http://localhost:8080/frameworks/keyed/wasm-bindgen/index.html](http://localhost:8080/frameworks/keyed/wasm-bindgen/index.html) and check for console errors. You could also try without using `--headless` to debug.
117-
118-
The results for that run will be saved in the `webdriver-ts/results` directory. We can take a look at the results of a single result:
119-
```
120-
cat results/wasm-bindgen-v0.2.47-keyed_01_run1k.json
121-
122-
{
123-
"framework": "wasm-bindgen-v0.2.47-keyed",
124-
"keyed": true,
125-
"benchmark": "01_run1k",
126-
"type": "cpu",
127-
"min": 101.123,
128-
"max": 114.547,
129-
"mean": 107.69300000000001,
130-
"median": 105.821,
131-
"geometricMean": 107.5587774247631,
132-
"standardDeviation": 6.028027040417119,
133-
"values": [
134-
114.547,
135-
113.509,
136-
103.465,
137-
105.821,
138-
101.123
139-
]
140-
}
141-
```
142-
As you can see the mean duration for create 1000 rows was 107 msecs.
143-
144-
You can also check whether the implementation appears to be compliant to the rules:
145-
```
146-
npm run check keyed/wasm-bindgen
147-
```
148-
If it finds anything it'll report an ERROR.
149-
150-
## 4. Building the result table
151-
152-
Install libraries
153-
```
154-
(cd webdriver-ts-results && npm install)
155-
```
156-
157-
In the webdriver-ts directory issue the following command:
158-
```
159-
npm run results
160-
```
161-
Now a result table should have been created which can be opened on [http://localhost:8080/webdriver-ts-results/table.html](http://localhost:8080/webdriver-ts-results/table.html).
162-
163-
## 5. Building and running the benchmarks for all frameworks
164-
165-
From the base directory, you can build all frameworks by running
16671
```
167-
npm install
168-
npm run build-prod
72+
./benchmark_change.sh $CHANGED_YEW_PROJECT
16973
```
170-
171-
You can now run the benchmark for all frameworks by:
172-
173-
1. Navigate to the `webdriver-ts/` directory
174-
2. Run benches: `npm run bench -- --headless --count <COUNT>`
175-
3. Process results: `npm run results`
176-
177-
After that, you can check all results in [http://localhost:8080/webdriver-ts/table.html](http://localhost:8080/webdriver-ts/table.html).
178-
179-
## Tips and tricks
180-
181-
* You can run multiple frameworks by passing their directory names (cd to webdriver-ts):
182-
`npm run bench keyed/yew-baseline keyed/yew` or if you want to pass more options it becomes:
183-
`npm run bench -- --count 3 keyed/yew`.
184-
* You can run all of the frameworks you've installed using `npm run bench -- --installed`
185-
* To achieve good precision you should run each framework often enough. I recommend at least 10 times, more is better. The result table contains the mean and the standard deviation. You can seen the effect on the latter pretty well if you increase the count.
186-
74+
where `$CHANGED_YEW_PROJECT` is the path to the root of the yew project you have
75+
your changes in.

bechmark_change.sh renamed to benchmark_change.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ http -p 8080 &
66
(
77
set -euo pipefail
88

9-
npm install -d
9+
git checkout HEAD -- frameworks/keyed/yew/Cargo.toml
10+
sed -i "s/PATH/$1\/packages/yew/" frameworks/keyed/yew/Cargo.toml
11+
12+
npm ci
1013

1114
(
1215
set -euo pipefail
@@ -37,7 +40,7 @@ http -p 8080 &
3740
npm run results
3841
)
3942

40-
chromium http://localhost:8080/webdriver-ts-results/table.html
43+
xdg-open http://localhost:8080/webdriver-ts-results/table.html &
4144
)
4245

4346
kill %%

frameworks/keyed/yew/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ rand = {version = "0.7.3", features = ["wasm-bindgen", "small_rng"]}
1212
wasm-bindgen = "0.2.62"
1313

1414
# UPDATE TO USE YOUR BRANCH
15-
yew = {path = "/home/janis/src/yew/packages/yew"}
15+
yew = {path = "PATH"}
1616
# UPDATE TO USE YOUR BRANCH
1717

1818
[profile.release]

0 commit comments

Comments
 (0)