Skip to content

Commit bb2307b

Browse files
authored
Merge pull request #112 from capricorn86/task/111-document-performance-test
#111@patch: Adds performance test to README.md files.
2 parents 47b6190 + b254480 commit bb2307b

File tree

4 files changed

+74
-2
lines changed

4 files changed

+74
-2
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
A [JSDOM](https://github.com/jsdom/jsdom) alternative with support for server side rendering of web components.
77

8-
Happy DOM aims to support all common functionality of a web browser.
8+
Happy DOM aims to support the most common functionality of a web browser.
99

1010
[Read more about how to use Happy DOM](https://github.com/capricorn86/happy-dom/tree/master/packages/happy-dom)
1111

1212

13+
1314
### DOM Features
1415

1516
- Custom Elements (Web Components)
@@ -63,6 +64,24 @@ This package makes it easier to setup servering side rendering of web components
6364

6465

6566

67+
# Performance
68+
69+
| Operation | JSDOM | Happy DOM |
70+
| ------------------------------------ | ------- | --------- |
71+
| Import / Require | 333 ms | 45 ms |
72+
| Parse HTML | 256 ms | 26 ms |
73+
| Serialize HTML | 65 ms | 8 ms |
74+
| Render custom element | 214 ms | 19 ms |
75+
| querySelectorAll('tagname') | 4.9 ms | 0.7 ms |
76+
| querySelectorAll('.class') | 6.4 ms | 3.7 ms |
77+
| querySelectorAll('[attribute]') | 4.0 ms | 1.7 ms |
78+
| querySelectorAll('[class~="name"]') | 5.5 ms | 2.9 ms |
79+
| querySelectorAll(':nth-child(2n+1)') | 10.4 ms | 3.8 ms |
80+
81+
[See how the test was done here](https://github.com/capricorn86/happy-dom-performance-test)
82+
83+
84+
6685
# Whats New in 1.0.0?
6786

6887
- [Lerna](https://lerna.js.org/) is used for managing all packages within a single repository

packages/happy-dom/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,22 @@ AsyncWindow extends Window and adds support for fetch(). It also has a method ca
146146
The "window.whenAsyncComplete()" method can be used when executing scripts that contains asynchrounous tasks that has to be completed before the render of the page has been completed.
147147

148148

149+
# Performance
150+
151+
| Operation | JSDOM | Happy DOM |
152+
| ------------------------------------ | ------- | --------- |
153+
| Import / Require | 333 ms | 45 ms |
154+
| Parse HTML | 256 ms | 26 ms |
155+
| Serialize HTML | 65 ms | 8 ms |
156+
| Render custom element | 214 ms | 19 ms |
157+
| querySelectorAll('tagname') | 4.9 ms | 0.7 ms |
158+
| querySelectorAll('.class') | 6.4 ms | 3.7 ms |
159+
| querySelectorAll('[attribute]') | 4.0 ms | 1.7 ms |
160+
| querySelectorAll('[class~="name"]') | 5.5 ms | 2.9 ms |
161+
| querySelectorAll(':nth-child(2n+1)') | 10.4 ms | 3.8 ms |
162+
163+
[See how the test was done here](https://github.com/capricorn86/happy-dom-performance-test)
164+
149165

150166

151167
# Jest

packages/jest-environment/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,22 @@ Jest uses [JSDOM](https://github.com/jsdom/jsdom) as test environment by default
100100
```
101101

102102
3. Save the file.
103+
104+
105+
106+
# Performance
107+
108+
| Operation | JSDOM | Happy DOM |
109+
| ------------------------------------ | ------- | --------- |
110+
| Import / Require | 333 ms | 45 ms |
111+
| Parse HTML | 256 ms | 26 ms |
112+
| Serialize HTML | 65 ms | 8 ms |
113+
| Render custom element | 214 ms | 19 ms |
114+
| querySelectorAll('tagname') | 4.9 ms | 0.7 ms |
115+
| querySelectorAll('.class') | 6.4 ms | 3.7 ms |
116+
| querySelectorAll('[attribute]') | 4.0 ms | 1.7 ms |
117+
| querySelectorAll('[class~="name"]') | 5.5 ms | 2.9 ms |
118+
| querySelectorAll(':nth-child(2n+1)') | 10.4 ms | 3.8 ms |
119+
120+
[See how the test was done here](https://github.com/capricorn86/happy-dom-performance-test)
121+

packages/server-rendering/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,22 @@ const result = context.render({
8989

9090
// Outputs: <html><head><title>Test page</title></head><body><div class="myContainer">Test</div></body></html>
9191
console.log(result);
92-
```
92+
```
93+
94+
95+
# Performance
96+
97+
| Operation | JSDOM | Happy DOM |
98+
| ------------------------------------ | ------- | --------- |
99+
| Import / Require | 333 ms | 45 ms |
100+
| Parse HTML | 256 ms | 26 ms |
101+
| Serialize HTML | 65 ms | 8 ms |
102+
| Render custom element | 214 ms | 19 ms |
103+
| querySelectorAll('tagname') | 4.9 ms | 0.7 ms |
104+
| querySelectorAll('.class') | 6.4 ms | 3.7 ms |
105+
| querySelectorAll('[attribute]') | 4.0 ms | 1.7 ms |
106+
| querySelectorAll('[class~="name"]') | 5.5 ms | 2.9 ms |
107+
| querySelectorAll(':nth-child(2n+1)') | 10.4 ms | 3.8 ms |
108+
109+
[See how the test was done here](https://github.com/capricorn86/happy-dom-performance-test)
110+

0 commit comments

Comments
 (0)