Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop DOM parser #76

Merged
merged 3 commits into from
Oct 4, 2020
Merged

Drop DOM parser #76

merged 3 commits into from
Oct 4, 2020

Conversation

tindzk
Copy link
Member

@tindzk tindzk commented Oct 3, 2020

According to the browser benchmarks, the internal parser is twice as
fast as the DOM-based parser:

Benchmark: Parse HTML w/o attributes
- depth=2:
  units: 7
  iterations: 8801
  run time: 59092 μs/it ± 2280
- depth=6:
  units: 127
  iterations: 830
  run time: 854302 μs/it ± 251892
- depth=10:
  units: 2047
  iterations: 65
  run time: 8001891 μs/it ± 309583
- depth=14:
  units: 32767
  iterations: 4
  run time: 140500000 μs/it ± 5250000

Summary:
  Unit growth: 18.1x, 16.1x, 16.0x
  Run time growth: 14.5x, 9.4x, 17.6x

Benchmark: Parse HTML w/ attributes via DOM
- depth=2:
  units: 7
  iterations: 3148
  run time: 142371 μs/it ± 16459
- depth=6:
  units: 127
  iterations: 482
  run time: 1057465 μs/it ± 20120
- depth=10:
  units: 2047
  iterations: 31
  run time: 16211693 μs/it ± 336693
- depth=14:
  units: 32767
  iterations: 2
  run time: 271000000 μs/it ± 34000000

Summary:
  Unit growth: 18.1x, 16.1x, 16.0x
  Run time growth: 7.4x, 15.3x, 16.7x

Since there are various cases where the DOM parser exhibits slightly
different semantics, it is preferable to use the internal parser in
Scala.js too.

According to the browser benchmarks, the internal parser is twice as
fast as the DOM-based parser:

```
Benchmark: Parse HTML w/o attributes
- depth=2:
  units: 7
  iterations: 8801
  run time: 59092 μs/it ± 2280
- depth=6:
  units: 127
  iterations: 830
  run time: 854302 μs/it ± 251892
- depth=10:
  units: 2047
  iterations: 65
  run time: 8001891 μs/it ± 309583
- depth=14:
  units: 32767
  iterations: 4
  run time: 140500000 μs/it ± 5250000

Summary:
  Unit growth: 18.1x, 16.1x, 16.0x
  Run time growth: 14.5x, 9.4x, 17.6x

Benchmark: Parse HTML w/ attributes via DOM
- depth=2:
  units: 7
  iterations: 3148
  run time: 142371 μs/it ± 16459
- depth=6:
  units: 127
  iterations: 482
  run time: 1057465 μs/it ± 20120
- depth=10:
  units: 2047
  iterations: 31
  run time: 16211693 μs/it ± 336693
- depth=14:
  units: 32767
  iterations: 2
  run time: 271000000 μs/it ± 34000000

Summary:
  Unit growth: 18.1x, 16.1x, 16.0x
  Run time growth: 7.4x, 15.3x, 16.7x
```

Since there are various cases where the DOM parser exhibits slightly
different semantics, it is preferable to use the internal parser in
Scala.js too.
@tindzk tindzk merged commit d0c6717 into master Oct 4, 2020
@tindzk tindzk deleted the feat/drop-dom-parser branch October 4, 2020 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant