Skip to content

Convert recursive functions to iterative traversal #76

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

Merged
merged 4 commits into from
Apr 13, 2025

Conversation

swhitty
Copy link
Owner

@swhitty swhitty commented Apr 13, 2025

SVGs with deep nested nodes (100+ deep) fail to parse and render when performed off main thread in Swift Concurrency.

This PR converts the recursive functions within the SwiftDraw to use iterative traversal within;

  • Parser when building DOM
  • LayerTree.Builder when building LayerTree
  • CommandGenerator when creating array of rendering commands

Fixes #72

Copy link

codecov bot commented Apr 13, 2025

Codecov Report

Attention: Patch coverage is 71.52778% with 41 lines in your changes missing coverage. Please review.

Project coverage is 83.66%. Comparing base (63a6201) to head (a69e747).

Files with missing lines Patch % Lines
SwiftDraw/LayerTree.Layer.swift 4.54% 21 Missing ⚠️
SwiftDraw/LayerTree.Builder.swift 73.80% 11 Missing ⚠️
SwiftDraw/LayerTree.CommandGenerator.swift 83.01% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #76      +/-   ##
==========================================
- Coverage   83.89%   83.66%   -0.23%     
==========================================
  Files          82       82              
  Lines        7344     7384      +40     
==========================================
+ Hits         6161     6178      +17     
- Misses       1183     1206      +23     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@swhitty swhitty merged commit 7bf84f7 into main Apr 13, 2025
27 of 30 checks passed
@swhitty swhitty deleted the iterative-traversal branch April 13, 2025 06:55
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.

Hard crash while parsing Wikipedia SVG
1 participant