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

feat: Enhanced layout alignments #330

Merged
merged 33 commits into from
Oct 26, 2023
Merged

feat: Enhanced layout alignments #330

merged 33 commits into from
Oct 26, 2023

Conversation

marc2332
Copy link
Owner

@marc2332 marc2332 commented Oct 14, 2023

Info #327

Changes

  • New main_align and cross_align attributes
    • Values: start (default), center and end
  • Deprecate the both direction
  • Deprecate the display attribute
  • Update book
  • Update examples
  • Refactored and cleaned up a lot of code
  • Updated and added new tests

Demo of alignment.rs:

image

@github-actions
Copy link

Benchmark for 00ae2ea

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + cached) + invalidated node in the bottom 79.4±0.44µs 75.6±0.49µs -4.79%
benchmarks/big trees (deep + cached) + invalidated node in the middle 95.5±0.31µs 89.9±0.31µs -5.86%
benchmarks/big trees (deep + cached) + invalidated node in the top 166.4±0.68µs 161.0±0.69µs -3.25%
benchmarks/big trees (deep) nodes=10000, depth=14 143.1±0.37µs 127.6±0.19µs -10.83%
benchmarks/big trees (deep) nodes=100000, depth=17 1306.4±15.65µs 1132.5±9.54µs -13.31%
benchmarks/big trees (deep) nodes=4000, depth=12 77.1±0.56µs 68.3±0.66µs -11.41%
benchmarks/big trees (wide) nodes=1000, depth=1 181.0±0.19µs 160.1±0.28µs -11.55%
benchmarks/big trees (wide) nodes=10000, depth=1 2.0±0.01ms 1779.9±3.29µs -11.00%
benchmarks/big trees (wide) nodes=100000, depth=1 30.6±1.26ms 30.4±1.06ms -0.65%

@github-actions
Copy link

Benchmark for f75a9d3

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + cached) + invalidated node in the bottom 96.7±9.42µs 92.4±14.28µs -4.45%
benchmarks/big trees (deep + cached) + invalidated node in the middle 126.2±12.67µs 112.8±11.04µs -10.62%
benchmarks/big trees (deep + cached) + invalidated node in the top 213.7±20.74µs 198.0±22.07µs -7.35%
benchmarks/big trees (deep) nodes=10000, depth=14 184.2±19.37µs 177.4±18.65µs -3.69%
benchmarks/big trees (deep) nodes=100000, depth=17 1533.6±160.06µs 1505.0±154.26µs -1.86%
benchmarks/big trees (deep) nodes=4000, depth=12 91.8±8.11µs 90.2±10.27µs -1.74%
benchmarks/big trees (wide) nodes=1000, depth=1 225.4±22.20µs 232.5±28.94µs +3.15%
benchmarks/big trees (wide) nodes=10000, depth=1 2.4±0.26ms 2.4±0.30ms 0.00%
benchmarks/big trees (wide) nodes=100000, depth=1 45.3±2.81ms 43.8±2.92ms -3.31%

@github-actions
Copy link

Benchmark for b990c4f

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + cached) + invalidated node in the bottom 76.4±0.56µs 76.7±0.44µs +0.39%
benchmarks/big trees (deep + cached) + invalidated node in the middle 92.9±0.44µs 90.9±0.25µs -2.15%
benchmarks/big trees (deep + cached) + invalidated node in the top 162.2±1.02µs 163.3±0.59µs +0.68%
benchmarks/big trees (deep) nodes=10000, depth=14 138.8±0.71µs 126.3±0.20µs -9.01%
benchmarks/big trees (deep) nodes=100000, depth=17 1262.4±17.65µs 1161.4±16.18µs -8.00%
benchmarks/big trees (deep) nodes=4000, depth=12 74.7±0.64µs 67.9±0.59µs -9.10%
benchmarks/big trees (wide) nodes=1000, depth=1 174.1±1.04µs 158.1±0.84µs -9.19%
benchmarks/big trees (wide) nodes=10000, depth=1 1963.2±12.51µs 1775.7±10.06µs -9.55%
benchmarks/big trees (wide) nodes=100000, depth=1 33.9±0.81ms 32.1±0.87ms -5.31%

@github-actions
Copy link

Benchmark for f1f4dda

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + cached) + invalidated node in the bottom 80.6±0.37µs 74.9±0.64µs -7.07%
benchmarks/big trees (deep + cached) + invalidated node in the middle 96.0±0.98µs 88.5±0.17µs -7.81%
benchmarks/big trees (deep + cached) + invalidated node in the top 168.4±0.33µs 157.7±0.25µs -6.35%
benchmarks/big trees (deep) nodes=10000, depth=14 131.1±0.24µs 118.2±0.26µs -9.84%
benchmarks/big trees (deep) nodes=100000, depth=17 1239.2±12.63µs 1115.6±11.66µs -9.97%
benchmarks/big trees (deep) nodes=4000, depth=12 68.2±0.75µs 63.6±0.84µs -6.74%
benchmarks/big trees (wide) nodes=1000, depth=1 164.1±1.76µs 148.5±17.72µs -9.51%
benchmarks/big trees (wide) nodes=10000, depth=1 1910.7±8.22µs 1713.7±15.46µs -10.31%
benchmarks/big trees (wide) nodes=100000, depth=1 31.7±0.63ms 34.9±1.39ms +10.09%

@codecov
Copy link

codecov bot commented Oct 14, 2023

Codecov Report

Attention: 101 lines in your changes are missing coverage. Please review.

Comparison is base (13d83b9) 51.86% compared to head (7f804b7) 53.71%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #330      +/-   ##
==========================================
+ Coverage   51.86%   53.71%   +1.84%     
==========================================
  Files         131      133       +2     
  Lines       11535    12024     +489     
==========================================
+ Hits         5983     6459     +476     
- Misses       5552     5565      +13     
Files Coverage Δ
crates/components/src/external_link.rs 0.00% <ø> (ø)
crates/components/src/switch.rs 0.00% <ø> (ø)
crates/components/src/table.rs 0.00% <ø> (ø)
crates/devtools/src/tabs/layout.rs 0.00% <ø> (ø)
crates/dom/src/dom_adapter.rs 54.54% <100.00%> (+0.32%) ⬆️
crates/elements/src/elements.rs 26.66% <ø> (ø)
crates/hooks/src/use_theme.rs 0.00% <ø> (ø)
crates/state/tests/parse_display.rs 100.00% <100.00%> (ø)
crates/testing/tests/test.rs 100.00% <ø> (ø)
crates/torin/src/dom_adapter.rs 100.00% <100.00%> (ø)
... and 20 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

Benchmark for a77d597

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + cached) + invalidated node in the bottom 105.9±10.61µs 107.2±9.87µs +1.23%
benchmarks/big trees (deep + cached) + invalidated node in the middle 128.1±12.22µs 126.7±11.51µs -1.09%
benchmarks/big trees (deep + cached) + invalidated node in the top 230.8±26.08µs 220.9±11.24µs -4.29%
benchmarks/big trees (deep) nodes=10000, depth=14 206.9±20.75µs 198.6±16.65µs -4.01%
benchmarks/big trees (deep) nodes=100000, depth=17 1875.7±353.27µs 1708.2±220.54µs -8.93%
benchmarks/big trees (deep) nodes=4000, depth=12 104.8±10.91µs 98.8±11.51µs -5.73%
benchmarks/big trees (wide) nodes=1000, depth=1 260.0±33.99µs 244.2±25.25µs -6.08%
benchmarks/big trees (wide) nodes=10000, depth=1 3.0±0.69ms 2.7±0.45ms -10.00%
benchmarks/big trees (wide) nodes=100000, depth=1 50.1±3.64ms 47.9±3.66ms -4.39%

@github-actions
Copy link

Benchmark for 275337e

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + cached) + invalidated node in the bottom 76.3±0.31µs 76.4±0.48µs +0.13%
benchmarks/big trees (deep + cached) + invalidated node in the middle 92.6±0.34µs 90.3±0.50µs -2.48%
benchmarks/big trees (deep + cached) + invalidated node in the top 162.1±0.55µs 161.9±0.60µs -0.12%
benchmarks/big trees (deep) nodes=10000, depth=14 141.7±0.17µs 126.2±0.20µs -10.94%
benchmarks/big trees (deep) nodes=100000, depth=17 1301.9±34.10µs 1194.7±25.41µs -8.23%
benchmarks/big trees (deep) nodes=4000, depth=12 75.6±0.59µs 68.0±0.61µs -10.05%
benchmarks/big trees (wide) nodes=1000, depth=1 177.1±0.28µs 160.8±3.41µs -9.20%
benchmarks/big trees (wide) nodes=10000, depth=1 2.0±0.02ms 1878.8±53.25µs -6.06%
benchmarks/big trees (wide) nodes=100000, depth=1 34.7±1.23ms 30.9±1.31ms -10.95%

@github-actions
Copy link

Benchmark for bd64667

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + cached) + invalidated node in the bottom 81.1±8.09µs 79.8±6.54µs -1.60%
benchmarks/big trees (deep + cached) + invalidated node in the middle 106.4±12.24µs 94.9±9.58µs -10.81%
benchmarks/big trees (deep + cached) + invalidated node in the top 177.7±20.63µs 174.9±17.53µs -1.58%
benchmarks/big trees (deep) nodes=10000, depth=14 162.3±15.67µs 153.4±11.90µs -5.48%
benchmarks/big trees (deep) nodes=100000, depth=17 1332.0±118.07µs 1268.8±100.49µs -4.74%
benchmarks/big trees (deep) nodes=4000, depth=12 83.5±10.19µs 79.6±9.99µs -4.67%
benchmarks/big trees (wide) nodes=1000, depth=1 200.4±16.17µs 200.6±25.38µs +0.10%
benchmarks/big trees (wide) nodes=10000, depth=1 2.0±0.21ms 1970.0±176.60µs -1.50%
benchmarks/big trees (wide) nodes=100000, depth=1 38.7±2.99ms 36.6±3.43ms -5.43%

@github-actions
Copy link

Benchmark for 8b1fbbf

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + cached) + invalidated node in the bottom 77.4±0.55µs 74.7±0.39µs -3.49%
benchmarks/big trees (deep + cached) + invalidated node in the middle 93.2±0.36µs 90.0±0.37µs -3.43%
benchmarks/big trees (deep + cached) + invalidated node in the top 163.5±0.62µs 159.6±0.59µs -2.39%
benchmarks/big trees (deep) nodes=10000, depth=14 141.8±0.67µs 128.4±0.18µs -9.45%
benchmarks/big trees (deep) nodes=100000, depth=17 1297.0±16.46µs 1158.2±11.89µs -10.70%
benchmarks/big trees (deep) nodes=4000, depth=12 75.4±0.56µs 69.7±0.51µs -7.56%
benchmarks/big trees (wide) nodes=1000, depth=1 177.9±0.23µs 161.1±0.95µs -9.44%
benchmarks/big trees (wide) nodes=10000, depth=1 1996.9±5.70µs 1842.0±10.41µs -7.76%
benchmarks/big trees (wide) nodes=100000, depth=1 29.4±0.93ms 31.9±0.78ms +8.50%

@github-actions
Copy link

Benchmark for 9908e90

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + branches + cached) + invalidated node in the middle 1585.3±99.78µs 1396.4±109.94µs -11.92%
benchmarks/big trees (deep + cached) + invalidated node in the bottom 126.4±0.64µs 119.6±0.83µs -5.38%
benchmarks/big trees (deep + cached) + invalidated node in the middle 144.7±0.82µs 135.3±36.18µs -6.50%
benchmarks/big trees (deep + cached) + invalidated node in the top 226.1±0.89µs 226.0±56.08µs -0.04%
benchmarks/big trees (deep) nodes=10000, depth=14 297.1±4.59µs 290.3±5.87µs -2.29%
benchmarks/big trees (deep) nodes=100000, depth=17 4.6±0.20ms 4.5±0.20ms -2.17%
benchmarks/big trees (deep) nodes=4000, depth=12 140.2±1.57µs 133.0±1.57µs -5.14%
benchmarks/big trees (wide) nodes=1000, depth=1 216.4±0.89µs 202.3±1.08µs -6.52%
benchmarks/big trees (wide) nodes=10000, depth=1 2.4±0.04ms 2.2±0.05ms -8.33%
benchmarks/big trees (wide) nodes=100000, depth=1 42.9±0.51ms 40.6±0.58ms -5.36%

@github-actions
Copy link

Benchmark for 9908e90

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + branches + cached) + invalidated node in the middle 1375.6±354.78µs 1323.8±217.08µs -3.77%
benchmarks/big trees (deep + cached) + invalidated node in the bottom 133.6±36.52µs 128.3±18.81µs -3.97%
benchmarks/big trees (deep + cached) + invalidated node in the middle 152.0±36.69µs 145.4±22.14µs -4.34%
benchmarks/big trees (deep + cached) + invalidated node in the top 244.8±24.55µs 238.3±24.71µs -2.66%
benchmarks/big trees (deep) nodes=10000, depth=14 305.5±72.08µs 293.3±109.32µs -3.99%
benchmarks/big trees (deep) nodes=100000, depth=17 5.6±0.41ms 5.4±0.40ms -3.57%
benchmarks/big trees (deep) nodes=4000, depth=12 148.0±13.60µs 140.9±25.23µs -4.80%
benchmarks/big trees (wide) nodes=1000, depth=1 242.8±13.74µs 229.7±31.50µs -5.40%
benchmarks/big trees (wide) nodes=10000, depth=1 2.6±0.28ms 2.7±0.23ms +3.85%
benchmarks/big trees (wide) nodes=100000, depth=1 45.9±2.10ms 41.6±1.59ms -9.37%

@github-actions
Copy link

Benchmark for 5b70ecb

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + branches + cached) + invalidated node in the middle 1658.9±174.73µs 1648.7±132.89µs -0.61%
benchmarks/big trees (deep + cached) + invalidated node in the bottom 101.8±0.57µs 102.6±0.72µs +0.79%
benchmarks/big trees (deep + cached) + invalidated node in the middle 116.8±0.57µs 115.5±0.78µs -1.11%
benchmarks/big trees (deep + cached) + invalidated node in the top 194.3±55.75µs 191.9±1.09µs -1.24%
benchmarks/big trees (deep) nodes=10000, depth=14 262.0±77.54µs 250.4±6.99µs -4.43%
benchmarks/big trees (deep) nodes=100000, depth=17 5.0±0.24ms 4.9±0.25ms -2.00%
benchmarks/big trees (deep) nodes=4000, depth=12 119.8±0.99µs 114.3±1.16µs -4.59%
benchmarks/big trees (wide) nodes=1000, depth=1 181.5±2.28µs 170.2±0.50µs -6.23%
benchmarks/big trees (wide) nodes=10000, depth=1 2.1±0.07ms 1801.5±15.95µs -14.21%
benchmarks/big trees (wide) nodes=100000, depth=1 42.9±1.23ms 39.9±1.20ms -6.99%

@github-actions
Copy link

Benchmark for 3bf80b4

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + branches + cached) + invalidated node in the middle 1293.9±82.42µs 1265.9±86.63µs -2.16%
benchmarks/big trees (deep + cached) + invalidated node in the bottom 129.1±54.11µs 127.3±41.72µs -1.39%
benchmarks/big trees (deep + cached) + invalidated node in the middle 148.2±46.55µs 143.4±51.27µs -3.24%
benchmarks/big trees (deep + cached) + invalidated node in the top 226.3±6.02µs 224.5±63.73µs -0.80%
benchmarks/big trees (deep) nodes=10000, depth=14 305.1±5.83µs 293.6±4.98µs -3.77%
benchmarks/big trees (deep) nodes=100000, depth=17 4.3±0.23ms 4.4±0.23ms +2.33%
benchmarks/big trees (deep) nodes=4000, depth=12 140.0±2.59µs 135.6±2.66µs -3.14%
benchmarks/big trees (wide) nodes=1000, depth=1 217.5±3.21µs 210.2±3.49µs -3.36%
benchmarks/big trees (wide) nodes=10000, depth=1 2.4±0.03ms 2.2±0.04ms -8.33%
benchmarks/big trees (wide) nodes=100000, depth=1 41.6±0.65ms 40.1±0.54ms -3.61%

@github-actions
Copy link

Benchmark for 3d56b8f

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + branches + cached) + invalidated node in the middle 1281.1±125.23µs 1376.2±119.76µs +7.42%
benchmarks/big trees (deep + cached) + invalidated node in the bottom 120.8±44.59µs 127.5±49.21µs +5.55%
benchmarks/big trees (deep + cached) + invalidated node in the middle 140.3±53.91µs 136.9±59.26µs -2.42%
benchmarks/big trees (deep + cached) + invalidated node in the top 224.5±4.28µs 221.2±4.14µs -1.47%
benchmarks/big trees (deep) nodes=10000, depth=14 301.8±8.27µs 284.5±7.45µs -5.73%
benchmarks/big trees (deep) nodes=100000, depth=17 4.3±0.28ms 4.5±0.28ms +4.65%
benchmarks/big trees (deep) nodes=4000, depth=12 141.6±63.17µs 131.5±2.46µs -7.13%
benchmarks/big trees (wide) nodes=1000, depth=1 215.8±3.03µs 197.2±2.94µs -8.62%
benchmarks/big trees (wide) nodes=10000, depth=1 2.4±0.07ms 2.2±0.05ms -8.33%
benchmarks/big trees (wide) nodes=100000, depth=1 42.3±0.75ms 38.1±0.75ms -9.93%

@github-actions
Copy link

Benchmark for ec568c5

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + branches + cached) + invalidated node in the middle 1419.8±264.24µs 1639.7±230.00µs +15.49%
benchmarks/big trees (deep + cached) + invalidated node in the bottom 135.2±71.08µs 135.5±65.70µs +0.22%
benchmarks/big trees (deep + cached) + invalidated node in the middle 159.8±73.24µs 152.9±26.96µs -4.32%
benchmarks/big trees (deep + cached) + invalidated node in the top 255.7±24.34µs 252.1±18.43µs -1.41%
benchmarks/big trees (deep) nodes=10000, depth=14 355.9±97.94µs 319.0±21.65µs -10.37%
benchmarks/big trees (deep) nodes=100000, depth=17 6.7±0.87ms 6.5±0.61ms -2.99%
benchmarks/big trees (deep) nodes=4000, depth=12 170.1±88.64µs 153.9±10.27µs -9.52%
benchmarks/big trees (wide) nodes=1000, depth=1 270.2±19.48µs 264.3±25.49µs -2.18%
benchmarks/big trees (wide) nodes=10000, depth=1 2.8±0.26ms 2.6±0.14ms -7.14%
benchmarks/big trees (wide) nodes=100000, depth=1 52.8±2.10ms 49.4±1.67ms -6.44%

@OlshaMB
Copy link
Contributor

OlshaMB commented Oct 24, 2023

Did the spacing get rescheduled to 0.3?

@marc2332
Copy link
Owner Author

Did the spacing get rescheduled to 0.3?

Not 0.3, maybe 0.2.X, I just think this PR is already too big, so I'll probably do it in another PR

@OlshaMB
Copy link
Contributor

OlshaMB commented Oct 24, 2023

Ok

@github-actions
Copy link

Benchmark for af83ba3

Click to view benchmark
Test Base PR %
benchmarks/big trees (deep + branches + cached) + invalidated node in the middle 1440.5±68.13µs 1323.0±55.22µs -8.16%
benchmarks/big trees (deep + cached) + invalidated node in the bottom 104.0±0.67µs 103.1±45.40µs -0.87%
benchmarks/big trees (deep + cached) + invalidated node in the middle 121.3±44.39µs 116.3±38.56µs -4.12%
benchmarks/big trees (deep + cached) + invalidated node in the top 183.8±0.72µs 179.7±0.63µs -2.23%
benchmarks/big trees (deep) nodes=10000, depth=14 259.6±3.75µs 253.5±5.48µs -2.35%
benchmarks/big trees (deep) nodes=100000, depth=17 4.3±0.15ms 4.1±0.12ms -4.65%
benchmarks/big trees (deep) nodes=4000, depth=12 119.0±13.90µs 113.5±0.94µs -4.62%
benchmarks/big trees (wide) nodes=1000, depth=1 184.4±0.48µs 173.3±0.73µs -6.02%
benchmarks/big trees (wide) nodes=10000, depth=1 2.1±0.03ms 1918.3±40.86µs -8.65%
benchmarks/big trees (wide) nodes=100000, depth=1 37.9±0.33ms 33.8±0.33ms -10.82%

@marc2332 marc2332 merged commit 437afa8 into main Oct 26, 2023
5 checks passed
@marc2332 marc2332 deleted the feat/enhanced-alignments branch October 26, 2023 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants