kkebo / zyphy

Zyphy is (or will be) a fast web browser engine written in Swift.
MIT License
4 stars 2 forks source link

perf!: improve performance of reading input #66

Closed kkebo closed 5 months ago

kkebo commented 5 months ago

refs #61

Comparing results between 'main' and 'Current_run'

Host 'Brown-rhinoceros-beetle' with 8 'aarch64' processors with 7 GB memory, running:
#1 SMP PREEMPT_DYNAMIC Wed Apr 24 00:11:34 UTC 2024

MyBenchmark

lipsum metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (μs) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 53 │ 53 │ 53 │ 53 │ 53 │ 56 │ 60 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 16 │ 17 │ 17 │ 17 │ 17 │ 17 │ 17 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ -37 │ -36 │ -36 │ -36 │ -36 │ -39 │ -43 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 70 │ 68 │ 68 │ 68 │ 68 │ 70 │ 72 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

lipsum-zh metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (ns) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 6558 │ 6562 │ 6566 │ 6623 │ 6787 │ 7025 │ 7048 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 2200 │ 2204 │ 2210 │ 2214 │ 2222 │ 2224 │ 2224 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ -4358 │ -4358 │ -4356 │ -4409 │ -4565 │ -4801 │ -4824 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 66 │ 66 │ 66 │ 67 │ 67 │ 68 │ 68 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

medium-fragment metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (μs) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 122 │ 122 │ 122 │ 123 │ 124 │ 130 │ 131 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 126 │ 126 │ 126 │ 127 │ 128 │ 131 │ 133 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ 4 │ 4 │ 4 │ 4 │ 4 │ 1 │ 2 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ -3 │ -3 │ -3 │ -3 │ -3 │ -1 │ -2 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

small-fragment metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (μs) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 15 │ 15 │ 15 │ 15 │ 15 │ 16 │ 16 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 14 │ 14 │ 14 │ 14 │ 14 │ 15 │ 15 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ -1 │ -1 │ -1 │ -1 │ -1 │ -1 │ -1 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 7 │ 7 │ 7 │ 7 │ 7 │ 6 │ 6 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

strong metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (μs) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 39 │ 39 │ 39 │ 39 │ 39 │ 42 │ 42 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 44 │ 44 │ 44 │ 44 │ 44 │ 46 │ 46 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ 5 │ 5 │ 5 │ 5 │ 5 │ 4 │ 4 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ -13 │ -13 │ -13 │ -13 │ -13 │ -10 │ -10 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

tiny-fragment metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (ns) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 501 │ 547 │ 753 │ 764 │ 766 │ 770 │ 806 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 506 │ 508 │ 509 │ 511 │ 527 │ 950 │ 952 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ 5 │ -39 │ -244 │ -253 │ -239 │ 180 │ 146 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ -1 │ 7 │ 32 │ 33 │ 31 │ -23 │ -18 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

github-actions[bot] commented 5 months ago

Code Metrics Report

main (0c882eb) #66 (5424927) +/-
Coverage 88.7% 89.2% +0.6%
Details ``` diff | | main (0c882eb) | #66 (5424927) | +/- | |-----------|----------------|---------------|-------| + | Coverage | 88.7% | 89.2% | +0.6% | | Files | 7 | 9 | +2 | | Lines | 1519 | 1599 | +80 | + | Covered | 1347 | 1427 | +80 | ```

Code coverage of files in pull request scope (88.4% → 89.0%)

Files Coverage +/-
Sources/Tokenizer/BufferQueue.swift 100.0% +100.0%
Sources/Tokenizer/CharRefTokenizer.swift 97.7% -0.0%
Sources/Tokenizer/SmallCharSet.swift 100.0% +100.0%
Sources/Tokenizer/Tokenizer.swift 87.3% +0.4%

Reported by octocov

github-actions[bot] commented 5 months ago

Code Metrics Report

main (0c882eb) #66 (5ad361c) +/-
Coverage 88.7% 89.2% +0.6%
Details ``` diff | | main (0c882eb) | #66 (5ad361c) | +/- | |-----------|----------------|---------------|-------| + | Coverage | 88.7% | 89.2% | +0.6% | | Files | 7 | 9 | +2 | | Lines | 1519 | 1599 | +80 | + | Covered | 1347 | 1427 | +80 | ```

Code coverage of files in pull request scope (88.4% → 89.0%)

Files Coverage +/-
Sources/Tokenizer/BufferQueue.swift 100.0% +100.0%
Sources/Tokenizer/CharRefTokenizer.swift 97.7% -0.0%
Sources/Tokenizer/SmallCharSet.swift 100.0% +100.0%
Sources/Tokenizer/Tokenizer.swift 87.3% +0.4%

Reported by octocov

github-actions[bot] commented 5 months ago

Code Metrics Report

main (0c882eb) #66 (22ddb09) +/-
Coverage 88.7% 89.0% +0.3%
Details ``` diff | | main (0c882eb) | #66 (22ddb09) | +/- | |-----------|----------------|---------------|-------| + | Coverage | 88.7% | 89.0% | +0.3% | | Files | 7 | 10 | +3 | | Lines | 1519 | 1593 | +74 | + | Covered | 1347 | 1418 | +71 | ```

Code coverage of files in pull request scope (88.6% → 88.9%)

Files Coverage +/-
Sources/Tokenizer/BufferQueue.swift 100.0% +100.0%
Sources/Tokenizer/CharRefTokenizer.swift 97.7% -0.0%
Sources/Tokenizer/DOCTYPE.swift 100.0% 0.0%
Sources/Tokenizer/SmallCharSet.swift 100.0% +100.0%
Sources/Tokenizer/Str.swift 100.0% +100.0%
Sources/Tokenizer/Tag.swift 100.0% 0.0%
Sources/Tokenizer/Tokenizer.swift 86.7% -0.1%
Sources/Tokenizer/Utils.swift 100.0% 0.0%

Reported by octocov

kkebo commented 5 months ago

Comparing results between 'main' and 'Current_run'

Host 'Brown-rhinoceros-beetle' with 8 'aarch64' processors with 7 GB memory, running:
#1 SMP PREEMPT_DYNAMIC Wed Apr 24 00:11:34 UTC 2024

MyBenchmark

lipsum metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (μs) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 53 │ 53 │ 53 │ 53 │ 53 │ 56 │ 60 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 16 │ 16 │ 16 │ 17 │ 17 │ 17 │ 17 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ -37 │ -37 │ -37 │ -36 │ -36 │ -39 │ -43 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 70 │ 70 │ 70 │ 68 │ 68 │ 70 │ 72 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

lipsum-zh metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (ns) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 6558 │ 6562 │ 6566 │ 6623 │ 6787 │ 7025 │ 7048 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 2282 │ 2294 │ 2296 │ 2300 │ 2304 │ 2307 │ 2307 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ -4276 │ -4268 │ -4270 │ -4323 │ -4483 │ -4718 │ -4741 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 65 │ 65 │ 65 │ 65 │ 66 │ 67 │ 67 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

medium-fragment metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (μs) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 122 │ 122 │ 122 │ 123 │ 124 │ 130 │ 131 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 67 │ 68 │ 68 │ 68 │ 68 │ 68 │ 68 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ -55 │ -54 │ -54 │ -55 │ -56 │ -62 │ -63 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 45 │ 44 │ 44 │ 45 │ 45 │ 48 │ 48 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

small-fragment metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (ns) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 15 │ 15 │ 15 │ 15 │ 15 │ 16 │ 16 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 6 │ 6 │ 6 │ 6 │ 6 │ 6 │ 6 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ -9 │ -9 │ -9 │ -9 │ -9 │ -10 │ -10 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 60 │ 60 │ 60 │ 60 │ 60 │ 62 │ 62 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

strong metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (μs) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 39 │ 39 │ 39 │ 39 │ 39 │ 42 │ 42 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 36 │ 36 │ 36 │ 36 │ 36 │ 36 │ 36 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ -3 │ -3 │ -3 │ -3 │ -3 │ -6 │ -6 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 8 │ 8 │ 8 │ 8 │ 8 │ 14 │ 14 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

tiny-fragment metrics

Time (wall clock): results within specified thresholds, fold down for details.

``` ╒══════════════════════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕ │ Time (wall clock) (ns) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡ │ main │ 501 │ 547 │ 753 │ 764 │ 766 │ 770 │ 806 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 529 │ 532 │ 533 │ 534 │ 536 │ 1001 │ 1004 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ 28 │ -15 │ -220 │ -230 │ -230 │ 231 │ 198 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ -6 │ 3 │ 29 │ 30 │ 30 │ -30 │ -25 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```