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

refactor: Per node states and lazy scaling #1103

Merged
merged 5 commits into from
Feb 9, 2025

Conversation

marc2332
Copy link
Owner

@marc2332 marc2332 commented Feb 9, 2025

Svg attributes now have its own state, same thing for images attributes, but this will only be included in SVG and images elements respectively

Scale will now be lazily applied only when needed

This should reduce the memory footprint and improve a bit the performance

@marc2332 marc2332 added performance ⚡️ Performance improvement ⚡️ internal impovement👍 Internal code improvements labels Feb 9, 2025
@marc2332 marc2332 added this to the 0.3.0 milestone Feb 9, 2025
Copy link

github-actions bot commented Feb 9, 2025

Benchmark for 470d232

Click to view benchmark
Test Base PR %
benchmarks/alignments=true size=21845 depth=8 wide=4 mode=not cached 113.7±0.58ms 111.8±0.50ms -1.67%
benchmarks/size=100001 depth=2 wide=100000 mode=not cached 26.4±1.23ms 26.6±1.04ms +0.76%
benchmarks/size=10001 depth=2 wide=10000 mode=not cached 1492.1±9.50µs 1471.0±9.91µs -1.41%
benchmarks/size=1001 depth=2 wide=1000 mode=not cached 141.2±7.98µs 139.3±7.86µs -1.35%
benchmarks/size=131071 depth=17 wide=2 mode=not cached 25.4±0.34ms 25.2±0.24ms -0.79%
benchmarks/size=16383 depth=14 wide=2 mode=not cached 1777.7±40.47µs 1800.8±7.95µs +1.30%
benchmarks/size=19531 depth=7 wide=5 mode=cached 319.0±5.93µs 311.7±5.04µs -2.29%
benchmarks/size=19531 depth=7 wide=5 mode=not cached 2.8±0.02ms 2.8±0.01ms 0.00%
benchmarks/size=4095 depth=12 wide=2 mode=not cached 435.6±48.46µs 433.5±36.87µs -0.48%
benchmarks/size=54241 depth=5 wide=15 mode=cached 250.7±9.35µs 257.1±11.23µs +2.55%
benchmarks/size=54241 depth=5 wide=15 mode=not cached 6.8±0.07ms 6.7±0.12ms -1.47%

Copy link

github-actions bot commented Feb 9, 2025

Benchmark for dfb2133

Click to view benchmark
Test Base PR %
benchmarks/alignments=true size=21845 depth=8 wide=4 mode=not cached 113.1±1.48ms 114.6±0.62ms +1.33%
benchmarks/size=100001 depth=2 wide=100000 mode=not cached 27.6±1.02ms 27.6±1.32ms 0.00%
benchmarks/size=10001 depth=2 wide=10000 mode=not cached 1478.4±41.42µs 1503.1±60.88µs +1.67%
benchmarks/size=1001 depth=2 wide=1000 mode=not cached 138.6±2.17µs 142.0±4.05µs +2.45%
benchmarks/size=131071 depth=17 wide=2 mode=not cached 26.0±0.98ms 25.7±0.99ms -1.15%
benchmarks/size=16383 depth=14 wide=2 mode=not cached 1815.8±78.26µs 1829.9±89.50µs +0.78%
benchmarks/size=19531 depth=7 wide=5 mode=cached 325.1±24.19µs 328.1±30.05µs +0.92%
benchmarks/size=19531 depth=7 wide=5 mode=not cached 2.9±0.12ms 2.9±0.16ms 0.00%
benchmarks/size=4095 depth=12 wide=2 mode=not cached 431.2±57.40µs 442.9±90.19µs +2.71%
benchmarks/size=54241 depth=5 wide=15 mode=cached 269.2±64.69µs 277.1±66.60µs +2.93%
benchmarks/size=54241 depth=5 wide=15 mode=not cached 6.8±0.37ms 6.9±0.40ms +1.47%

Copy link

github-actions bot commented Feb 9, 2025

Benchmark for 594c661

Click to view benchmark
Test Base PR %
benchmarks/alignments=true size=21845 depth=8 wide=4 mode=not cached 113.8±0.76ms 112.9±1.04ms -0.79%
benchmarks/size=100001 depth=2 wide=100000 mode=not cached 28.2±0.57ms 26.9±1.32ms -4.61%
benchmarks/size=10001 depth=2 wide=10000 mode=not cached 1478.4±13.88µs 1484.0±18.24µs +0.38%
benchmarks/size=1001 depth=2 wide=1000 mode=not cached 139.8±1.95µs 139.1±1.03µs -0.50%
benchmarks/size=131071 depth=17 wide=2 mode=not cached 26.3±0.31ms 25.3±0.60ms -3.80%
benchmarks/size=16383 depth=14 wide=2 mode=not cached 1834.5±92.36µs 1790.5±92.89µs -2.40%
benchmarks/size=19531 depth=7 wide=5 mode=cached 382.0±26.38µs 332.8±18.62µs -12.88%
benchmarks/size=19531 depth=7 wide=5 mode=not cached 3.0±0.10ms 2.8±0.02ms -6.67%
benchmarks/size=4095 depth=12 wide=2 mode=not cached 429.2±3.76µs 430.6±64.08µs +0.33%
benchmarks/size=54241 depth=5 wide=15 mode=cached 302.4±31.31µs 276.0±27.07µs -8.73%
benchmarks/size=54241 depth=5 wide=15 mode=not cached 7.0±0.18ms 6.8±0.08ms -2.86%

Copy link

codecov bot commented Feb 9, 2025

Codecov Report

Attention: Patch coverage is 72.34043% with 65 lines in your changes missing coverage. Please review.

Project coverage is 74.88%. Comparing base (9cb0f1f) to head (c9eddf8).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/core/src/states/svg.rs 68.42% 18 Missing ⚠️
crates/core/src/states/image.rs 75.00% 16 Missing ⚠️
crates/core/src/elements/rect.rs 64.70% 6 Missing ⚠️
crates/core/src/node.rs 54.54% 5 Missing ⚠️
crates/core/src/dom/mutations_writer.rs 60.00% 4 Missing ⚠️
crates/core/src/elements/svg.rs 0.00% 4 Missing ⚠️
crates/torin/src/scaled.rs 76.47% 4 Missing ⚠️
crates/core/src/render/utils/shadows.rs 0.00% 2 Missing ⚠️
crates/core/src/values/fill.rs 33.33% 2 Missing ⚠️
crates/core/src/render/utils/borders.rs 50.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1103      +/-   ##
==========================================
- Coverage   75.09%   74.88%   -0.21%     
==========================================
  Files         228      231       +3     
  Lines       28334    28418      +84     
==========================================
+ Hits        21276    21282       +6     
- Misses       7058     7136      +78     

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

@marc2332 marc2332 merged commit 82fa2aa into main Feb 9, 2025
8 of 9 checks passed
@marc2332 marc2332 deleted the refactor/per-node-states-and-lazy-scaling branch February 9, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal impovement👍 Internal code improvements performance ⚡️ Performance improvement ⚡️
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant