kkebo / zyphy

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

perf: avoid reallocations #76

Closed kkebo closed 1 month ago

kkebo commented 2 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 Fri May 17 17:22:13 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 │ 15 │ 16 │ 16 │ 16 │ 17 │ 17 │ 17 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 15 │ 15 │ 15 │ 16 │ 16 │ 16 │ 16 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ 0 │ -1 │ -1 │ 0 │ -1 │ -1 │ -1 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 0 │ 6 │ 6 │ 0 │ 6 │ 6 │ 6 │ 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 │ 2085 │ 2093 │ 2095 │ 2101 │ 2183 │ 2431 │ 2431 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 2095 │ 2103 │ 2107 │ 2116 │ 2120 │ 2254 │ 2254 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ 10 │ 10 │ 12 │ 15 │ -63 │ -177 │ -177 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 0 │ 0 │ -1 │ -1 │ 3 │ 7 │ 7 │ 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 │ 49 │ 49 │ 49 │ 49 │ 50 │ 52 │ 53 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 49 │ 49 │ 49 │ 49 │ 50 │ 53 │ 53 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ 0 │ 0 │ 0 │ 0 │ 0 │ 1 │ 0 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 0 │ 0 │ 0 │ 0 │ 0 │ -2 │ 0 │ 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 │ 5272 │ 5288 │ 5321 │ 5468 │ 5505 │ 5659 │ 5659 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 5252 │ 5272 │ 5296 │ 5300 │ 5308 │ 5456 │ 5514 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ -20 │ -16 │ -25 │ -168 │ -197 │ -203 │ -145 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 0 │ 0 │ 0 │ 3 │ 4 │ 4 │ 3 │ 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 │ 22 │ 22 │ 22 │ 22 │ 23 │ 24 │ 24 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 22 │ 22 │ 22 │ 22 │ 22 │ 24 │ 24 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ 0 │ 0 │ 0 │ 0 │ -1 │ 0 │ 0 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ 0 │ 0 │ 0 │ 0 │ 4 │ 0 │ 0 │ 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 │ 516 │ 520 │ 538 │ 559 │ 1048 │ 1115 │ 1116 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Current_run │ 540 │ 563 │ 655 │ 768 │ 859 │ 1058 │ 1061 │ 100 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Δ │ 24 │ 43 │ 117 │ 209 │ -189 │ -57 │ -55 │ 0 │ ├──────────────────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤ │ Improvement % │ -5 │ -8 │ -22 │ -37 │ 18 │ 5 │ 5 │ 0 │ ╘══════════════════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛ ```

github-actions[bot] commented 2 months ago

Code Metrics Report

main (697e587) #76 (7c1eec4) +/-
Coverage 89.2% 89.2% +0.0%
Details ``` diff | | main (697e587) | #76 (7c1eec4) | +/- | |-----------|----------------|---------------|-------| + | Coverage | 89.2% | 89.2% | +0.0% | | Files | 9 | 9 | 0 | | Lines | 1609 | 1615 | +6 | + | Covered | 1435 | 1441 | +6 | ```

Code coverage of files in pull request scope (87.3% → 87.4%)

Files Coverage +/-
Sources/Tokenizer/Tokenizer.swift 87.4% +0.1%

Reported by octocov

github-actions[bot] commented 2 months ago

Code Metrics Report

main (697e587) #76 (431464e) +/-
Coverage 89.2% 89.2% +0.0%
Details ``` diff | | main (697e587) | #76 (431464e) | +/- | |-----------|----------------|---------------|-------| + | Coverage | 89.2% | 89.2% | +0.0% | | Files | 9 | 9 | 0 | | Lines | 1609 | 1615 | +6 | + | Covered | 1435 | 1441 | +6 | ```

Code coverage of files in pull request scope (87.3% → 87.4%)

Files Coverage +/-
Sources/Tokenizer/Tokenizer.swift 87.4% +0.1%

Reported by octocov