Skip to content

feat: add viewport renderer#1464

Open
Azraeel wants to merge 1 commit into
Azgaar:masterfrom
Azraeel:viewport-renderer
Open

feat: add viewport renderer#1464
Azraeel wants to merge 1 commit into
Azgaar:masterfrom
Azraeel:viewport-renderer

Conversation

@Azraeel

@Azraeel Azraeel commented Jun 3, 2026

Copy link
Copy Markdown

Performance

Synthetic stress profile in headless Chromium at scale 5: 12,000 burgs, 4,000 routes, 24 camera moves. Values are one local run and should be treated as directional, not a cross-device guarantee.

Metric master This branch Change
Live heavy-layer nodes 17,200 654 -96.2%
Total SVG nodes 18,125 1,579 -91.3%
Initial route + burg draw 52.9 ms 17.5 ms -66.9%
Traced task time 761.1 ms 488.6 ms -35.8%
Layout time 26.1 ms 13.4 ms -48.5%

On a generated 1,028-burg / 837-route map, scale 1 retained 10 burg icons and 191 route paths. A focused scale-5 viewport retained 19 icons and 27 route paths. A full export clone restored all 1,028 icons, 205 anchors, and 837 routes.

@netlify

netlify Bot commented Jun 3, 2026

Copy link
Copy Markdown

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit 0a22038
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/6a20144394ab29000884e03d
😎 Deploy Preview https://deploy-preview-1464--afmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Azraeel Azraeel changed the title Add Viewport Renderer Feat: Add Viewport Renderer Jun 3, 2026
@Azraeel

Azraeel commented Jun 3, 2026

Copy link
Copy Markdown
Author

This helps significantly on 100k point maps with lots of burgs, rivers, and labels.
Kills most of the oppressive UI Lag on huge maps too.

Performance Notes

Measured against origin/master on a dense generated map:

Metric master viewport-renderer Change
Burg label DOM nodes 1,202 324 -73.0%
Burg icon DOM nodes 1,202 324 -73.0%
Route path DOM nodes 1,072 463 -56.8%
Exported burg labels 1,202 1,202 full export preserved
Exported burg icons 1,202 1,202 full export preserved
Exported routes 1,072 1,072 full export preserved

Chrome trace over scripted pan/zoom sequence:

Trace work master viewport-renderer Change
Layout 292.43ms 192.50ms -34.2%
PrePaint 58.24ms 32.79ms -43.7%
Paint 124.06ms 106.18ms -14.4%
Layout + PrePaint + Paint 474.73ms 331.47ms -30.2%

@Azgaar
Azgaar self-requested a review June 3, 2026 12:16
@Azgaar

Azgaar commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Hello and thanks for the contribution! I like the concept, but the code is really messy and unpolished. If we rethink it into a minimal system, then we can try to go with it.

@Azraeel

Azraeel commented Jun 3, 2026

Copy link
Copy Markdown
Author

sure i can do some significant polish !

@Azgaar

Azgaar commented Jun 3, 2026

Copy link
Copy Markdown
Owner

I mean we need to rethink the concept. E.g. for burg labels/icon we already have a system to hide them based on zoom level, so we can omit them from DOM as well. Can do the same for routes. You solution is overcomplicated, like on zoom 1 I get 812 burgs of group town generated, all of them as hidden on that zoom, but I see 188 of them in DOM. I would prefer a ViewportRenderer to completely replace the old invokeActiveZooming function and zoomRaf concept to actually remove/add elements to DOM rather then just hide/show on the parent level.

There is also a dependency on labels positions that we currently keep in svg (not in pack data), so #1313 should be completed first to not lose the data on dom recreation.

@Azraeel

Azraeel commented Jun 3, 2026

Copy link
Copy Markdown
Author

ahhh thats makes sense!
I can work on that if we could communicate more deeply on the topic!

@Azgaar

Azgaar commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Yes, would need to start with a proper planning, PRD creation, then architecture scheme and only then to development.

@Azgaar

Azgaar commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Drafted an AI PRD for the change:
viewport_rendering_prd_Version3.md

It still requires a lot of thinking as it can be done more elegantly, but the idea is clear.

@Azraeel
Azraeel marked this pull request as draft June 8, 2026 20:42
@Azraeel
Azraeel force-pushed the viewport-renderer branch from 0a22038 to 9fc5ced Compare July 12, 2026 22:10
@netlify

netlify Bot commented Jul 12, 2026

Copy link
Copy Markdown

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit 9fc5ced
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/6a5410c3fa734900083f5b96
😎 Deploy Preview https://deploy-preview-1464--afmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Azraeel Azraeel changed the title Feat: Add Viewport Renderer feat: add viewport renderer Jul 12, 2026
@Azraeel

Azraeel commented Jul 12, 2026

Copy link
Copy Markdown
Author

Sorry this took me so long but in accordance with #1313 and the PRD as well as some additional thoughts on the matter, I've recrafted this PR in the newest commit.

Quick test with 12,000 burgs and 4,000 routes reduced live heavy-layer nodes by 96.2%, initial drawing from 52.9 ms to 17.5 ms, and layout from 26.1 ms to 13.4 ms.

@Azraeel
Azraeel marked this pull request as ready for review July 13, 2026 17:58
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.

2 participants