-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Experiment: Render timing pipeline in SVG #15091
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
Conversation
|
r? @weihanglo rustbot has assigned @weihanglo. Use |
ac8c105 to
8761588
Compare
|
For context, the original version of this used SVG. However, it was switched to canvas due to severe rendering performance problems on some systems and browsers. Has this been thoroughly tested on multiple browsers, and on systems with limited video cards, and different platforms? |
Yeah, I noticed this part.
No, I haven't tested it with legacy devices or systems, only the newest Firefox and Chrome. Testers and feedback are welcome :D |
Any chance to recall those legacy systems and browsers? |
It was probably a 2018-era Intel integrated UHD Graphics 630 or AMD Radeon Pro 560X with an Intel Core i7 (macbook). I think Firefox was one of the worst in performance, but Safari and Chrome were also pretty bad. I believe Firefox has improved its SVG rendering since then. |
For Firefox, although the SVG renders without issues, I encountered significant frame drops while scrolling on an M1 device when experimenting with this SVG solution for I'm not sure if this performance issue is solvable without modifying the presentation. If we only rendered dependency lines for on-screen blocks, the performance would improve significantly, although I'm not sure if this approach is desirable. |
This comment has been minimized.
This comment has been minimized.
|
@eth3lbert are you still interested in the experiment? Should we continue from here or write down a summary in #8850? @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
Yes, still interesting! But I am wondering if implementing this using the interactive approach, as mentioned in the #8850 (comment) would be more appropriate:
Specifically, we could restrict the width and height and provide pan and zoom functionality (which could be implemented using either canvas or SVG). Furthermore, we could also provide the ability to change the size and add search functionality if needed. This approach would restrict memory usage to an acceptable level and potentially further improve performance. The drawback might be that users with large screens might lose the ability to view the whole graph at once and would need to zoom in. We could also provide a graph export ability for those interested in the entire graph. This, however, would change how the graph is shown and interacted with, and I am unsure if this aligns with the goal. Feedback is welcome! :D |
This reminds me a property we discussed a while back (#t-cargo > ✔ Making timings chart scalable @ 💬): it is possible to set two different timings charts to identical scales for comparison. Not sure if the proposal will remove this or not. That said, it might be a bit easier to implement now since the |
|
Or we could have a button for people to switch between two modes 😆 |
Thanks for the information, I'll take a look in the near future :D
Is this referring to canvas and SVG rendering, or to panning and zooming? |
|
For switching between SVG/canvas, but could also for other stuff. This is not strictly adhered with Cargo's stability guarantee I believe. |
This allows users to choose between canvas and SVG rendering, and it defaults to canvas.
When rendering SVGs with a large number of units, Firefox becomes quite janky during scrolling. This appears to be caused by dependency lines that use merged paths and dashed styles. Therefore, this approach splits them into multiple paths instead.
8761588 to
d4e9a7a
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
I've added this now! The CI failed, but it shouldn't be related to this PR. The scrolling jank in Firefox is also fixed on my end, so please give it a try and let me know what you think. :D |
|
I also found that highlighting connected units on hover is less useful when there are many units. They might not all fit on the screen, which means you have to scroll a long way to find the connections. Plus, you might accidentally hover over other units while scrolling. Because of this, a different interface would be more helpful for showing these relations. For example, clicking a unit to show its connections in a side panel might provide a better UX. |
|
Windows GNU flakiness. Re-running |
| <td> | ||
| <label> | ||
| <input type="radio" name="renderer" value="canvas" checked /> | ||
| Canvas | ||
| </label> | ||
| <label> | ||
| <input type="radio" name="renderer" value="svg" /> | ||
| SVG | ||
| </label> | ||
| </td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I plan to make the SVG renderer the default, since it outperformed Canvas in my testing across Firefox, Chrome, and Safari!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and really really impressive!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. The PR is so nice for both refactors and the SVG implementation.
I assume this doesn't need any team FCP:
- It offers a switch between canvas and SVG rendering options. If anything broken, people can always switch back.
- The default is still canvas.
- The HTML report UI is for human not for machine, so we have more flexibility to change it.
I am excited to merge this right now! Really appreciate it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also found that highlighting connected units on hover is less useful when there are many units. They might not all fit on the screen, which means you have to scroll a long way to find the connections. Plus, you might accidentally hover over other units while scrolling. Because of this, a different interface would be more helpful for showing these relations. For example, clicking a unit to show its connections in a side panel might provide a better UX.
Agree with side panel solution. That sounds pretty approachable.
I am not sure if it is easy to implement though, as currently we don't use any Web Frontend frame work, which may make it a bit hard to maintain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried with CARGO_BUILD_ANALYSIS_ENABLED=true rustup run nightly target/debug/cargo build -Zsection-timings -Zbuild-analysis && target/debug/cargo report timings -Zbuild-analysis --open. The performance enhancement was so huge!
- Google Chrome: Version 143.0.7499.170 (Official Build) (arm64)
- Safari: Version 26.2 (20623.1.14.18.4)
- Firefox: 145.0 (aarch64)
- Tried set the scale factor to 9.
- Chose the canvas renderer
- Observed on Chrome and Safari, it was laggy and stopped rendering at some point.
- Observed on Firefox it worked.
- Switched to the SVG renderer
- All of them works well.
- On Firefox the dependency line drawing was faster than the canvas renderer.
Here is the timing HTML: cargo-timing.html
Update cargo submodule 17 commits in e91b2baa632c0c7e84216c91ecfe107c37d887c1..94c368ad2b9db0f0da5bdd8421cea13786ce4412 2025-12-13 16:29:21 +0000 to 2025-12-26 19:39:15 +0000 - fix(vendor): unpack from local-registry cache path (rust-lang/cargo#16435) - feat(index): Stabilize pubtime (rust-lang/cargo#16372) - Experiment: Render timing pipeline in SVG (rust-lang/cargo#15091) - chore(triagebot): auto-label `Command-report` (rust-lang/cargo#16429) - fix(sbom): Don't set CARGO_SBOM_PATH when empty (like stable) (rust-lang/cargo#16419) - chore(ci): report-timings to upload HTML report (rust-lang/cargo#16416) - fix(report): get the same feature parity of `--timings` (rust-lang/cargo#16414) - fix(docs): Document the only possible values for DEBUG in build scripts (rust-lang/cargo#16413) - fix(log): emit fingeprint log also for no-rebuild unit (rust-lang/cargo#16408) - Fix link to `doc_cfg` docs in cargo book (rust-lang/cargo#16404) - Add best pratice for how to check in generated files (rust-lang/cargo#16405) - test: Use a larger default term width (rust-lang/cargo#16403) - Document more services and permissions of the cargo team (rust-lang/cargo#16402) - fix(new): Improve quality of package name error messages (rust-lang/cargo#16398) - feat(log): add more log events (rust-lang/cargo#16390) - chore: bump to 0.95.0; update changelog (rust-lang/cargo#16395) - Cache submodule into git db (rust-lang/cargo#16246) r? ghost
Update cargo submodule 17 commits in e91b2baa632c0c7e84216c91ecfe107c37d887c1..94c368ad2b9db0f0da5bdd8421cea13786ce4412 2025-12-13 16:29:21 +0000 to 2025-12-26 19:39:15 +0000 - fix(vendor): unpack from local-registry cache path (rust-lang/cargo#16435) - feat(index): Stabilize pubtime (rust-lang/cargo#16372) - Experiment: Render timing pipeline in SVG (rust-lang/cargo#15091) - chore(triagebot): auto-label `Command-report` (rust-lang/cargo#16429) - fix(sbom): Don't set CARGO_SBOM_PATH when empty (like stable) (rust-lang/cargo#16419) - chore(ci): report-timings to upload HTML report (rust-lang/cargo#16416) - fix(report): get the same feature parity of `--timings` (rust-lang/cargo#16414) - fix(docs): Document the only possible values for DEBUG in build scripts (rust-lang/cargo#16413) - fix(log): emit fingeprint log also for no-rebuild unit (rust-lang/cargo#16408) - Fix link to `doc_cfg` docs in cargo book (rust-lang/cargo#16404) - Add best pratice for how to check in generated files (rust-lang/cargo#16405) - test: Use a larger default term width (rust-lang/cargo#16403) - Document more services and permissions of the cargo team (rust-lang/cargo#16402) - fix(new): Improve quality of package name error messages (rust-lang/cargo#16398) - feat(log): add more log events (rust-lang/cargo#16390) - chore: bump to 0.95.0; update changelog (rust-lang/cargo#16395) - Cache submodule into git db (rust-lang/cargo#16246) r? ghost
Update cargo submodule 17 commits in e91b2baa632c0c7e84216c91ecfe107c37d887c1..94c368ad2b9db0f0da5bdd8421cea13786ce4412 2025-12-13 16:29:21 +0000 to 2025-12-26 19:39:15 +0000 - fix(vendor): unpack from local-registry cache path (rust-lang/cargo#16435) - feat(index): Stabilize pubtime (rust-lang/cargo#16372) - Experiment: Render timing pipeline in SVG (rust-lang/cargo#15091) - chore(triagebot): auto-label `Command-report` (rust-lang/cargo#16429) - fix(sbom): Don't set CARGO_SBOM_PATH when empty (like stable) (rust-lang/cargo#16419) - chore(ci): report-timings to upload HTML report (rust-lang/cargo#16416) - fix(report): get the same feature parity of `--timings` (rust-lang/cargo#16414) - fix(docs): Document the only possible values for DEBUG in build scripts (rust-lang/cargo#16413) - fix(log): emit fingeprint log also for no-rebuild unit (rust-lang/cargo#16408) - Fix link to `doc_cfg` docs in cargo book (rust-lang/cargo#16404) - Add best pratice for how to check in generated files (rust-lang/cargo#16405) - test: Use a larger default term width (rust-lang/cargo#16403) - Document more services and permissions of the cargo team (rust-lang/cargo#16402) - fix(new): Improve quality of package name error messages (rust-lang/cargo#16398) - feat(log): add more log events (rust-lang/cargo#16390) - chore: bump to 0.95.0; update changelog (rust-lang/cargo#16395) - Cache submodule into git db (rust-lang/cargo#16246) r? ghost
Update cargo submodule 17 commits in e91b2baa632c0c7e84216c91ecfe107c37d887c1..94c368ad2b9db0f0da5bdd8421cea13786ce4412 2025-12-13 16:29:21 +0000 to 2025-12-26 19:39:15 +0000 - fix(vendor): unpack from local-registry cache path (rust-lang/cargo#16435) - feat(index): Stabilize pubtime (rust-lang/cargo#16372) - Experiment: Render timing pipeline in SVG (rust-lang/cargo#15091) - chore(triagebot): auto-label `Command-report` (rust-lang/cargo#16429) - fix(sbom): Don't set CARGO_SBOM_PATH when empty (like stable) (rust-lang/cargo#16419) - chore(ci): report-timings to upload HTML report (rust-lang/cargo#16416) - fix(report): get the same feature parity of `--timings` (rust-lang/cargo#16414) - fix(docs): Document the only possible values for DEBUG in build scripts (rust-lang/cargo#16413) - fix(log): emit fingeprint log also for no-rebuild unit (rust-lang/cargo#16408) - Fix link to `doc_cfg` docs in cargo book (rust-lang/cargo#16404) - Add best pratice for how to check in generated files (rust-lang/cargo#16405) - test: Use a larger default term width (rust-lang/cargo#16403) - Document more services and permissions of the cargo team (rust-lang/cargo#16402) - fix(new): Improve quality of package name error messages (rust-lang/cargo#16398) - feat(log): add more log events (rust-lang/cargo#16390) - chore: bump to 0.95.0; update changelog (rust-lang/cargo#16395) - Cache submodule into git db (rust-lang/cargo#16246) r? ghost
Update cargo submodule 17 commits in e91b2baa632c0c7e84216c91ecfe107c37d887c1..94c368ad2b9db0f0da5bdd8421cea13786ce4412 2025-12-13 16:29:21 +0000 to 2025-12-26 19:39:15 +0000 - fix(vendor): unpack from local-registry cache path (rust-lang/cargo#16435) - feat(index): Stabilize pubtime (rust-lang/cargo#16372) - Experiment: Render timing pipeline in SVG (rust-lang/cargo#15091) - chore(triagebot): auto-label `Command-report` (rust-lang/cargo#16429) - fix(sbom): Don't set CARGO_SBOM_PATH when empty (like stable) (rust-lang/cargo#16419) - chore(ci): report-timings to upload HTML report (rust-lang/cargo#16416) - fix(report): get the same feature parity of `--timings` (rust-lang/cargo#16414) - fix(docs): Document the only possible values for DEBUG in build scripts (rust-lang/cargo#16413) - fix(log): emit fingeprint log also for no-rebuild unit (rust-lang/cargo#16408) - Fix link to `doc_cfg` docs in cargo book (rust-lang/cargo#16404) - Add best pratice for how to check in generated files (rust-lang/cargo#16405) - test: Use a larger default term width (rust-lang/cargo#16403) - Document more services and permissions of the cargo team (rust-lang/cargo#16402) - fix(new): Improve quality of package name error messages (rust-lang/cargo#16398) - feat(log): add more log events (rust-lang/cargo#16390) - chore: bump to 0.95.0; update changelog (rust-lang/cargo#16395) - Cache submodule into git db (rust-lang/cargo#16246) r? ghost
Update cargo submodule 17 commits in e91b2baa632c0c7e84216c91ecfe107c37d887c1..94c368ad2b9db0f0da5bdd8421cea13786ce4412 2025-12-13 16:29:21 +0000 to 2025-12-26 19:39:15 +0000 - fix(vendor): unpack from local-registry cache path (rust-lang/cargo#16435) - feat(index): Stabilize pubtime (rust-lang/cargo#16372) - Experiment: Render timing pipeline in SVG (rust-lang/cargo#15091) - chore(triagebot): auto-label `Command-report` (rust-lang/cargo#16429) - fix(sbom): Don't set CARGO_SBOM_PATH when empty (like stable) (rust-lang/cargo#16419) - chore(ci): report-timings to upload HTML report (rust-lang/cargo#16416) - fix(report): get the same feature parity of `--timings` (rust-lang/cargo#16414) - fix(docs): Document the only possible values for DEBUG in build scripts (rust-lang/cargo#16413) - fix(log): emit fingeprint log also for no-rebuild unit (rust-lang/cargo#16408) - Fix link to `doc_cfg` docs in cargo book (rust-lang/cargo#16404) - Add best pratice for how to check in generated files (rust-lang/cargo#16405) - test: Use a larger default term width (rust-lang/cargo#16403) - Document more services and permissions of the cargo team (rust-lang/cargo#16402) - fix(new): Improve quality of package name error messages (rust-lang/cargo#16398) - feat(log): add more log events (rust-lang/cargo#16390) - chore: bump to 0.95.0; update changelog (rust-lang/cargo#16395) - Cache submodule into git db (rust-lang/cargo#16246) r? ghost
Update cargo submodule 17 commits in e91b2baa632c0c7e84216c91ecfe107c37d887c1..94c368ad2b9db0f0da5bdd8421cea13786ce4412 2025-12-13 16:29:21 +0000 to 2025-12-26 19:39:15 +0000 - fix(vendor): unpack from local-registry cache path (rust-lang/cargo#16435) - feat(index): Stabilize pubtime (rust-lang/cargo#16372) - Experiment: Render timing pipeline in SVG (rust-lang/cargo#15091) - chore(triagebot): auto-label `Command-report` (rust-lang/cargo#16429) - fix(sbom): Don't set CARGO_SBOM_PATH when empty (like stable) (rust-lang/cargo#16419) - chore(ci): report-timings to upload HTML report (rust-lang/cargo#16416) - fix(report): get the same feature parity of `--timings` (rust-lang/cargo#16414) - fix(docs): Document the only possible values for DEBUG in build scripts (rust-lang/cargo#16413) - fix(log): emit fingeprint log also for no-rebuild unit (rust-lang/cargo#16408) - Fix link to `doc_cfg` docs in cargo book (rust-lang/cargo#16404) - Add best pratice for how to check in generated files (rust-lang/cargo#16405) - test: Use a larger default term width (rust-lang/cargo#16403) - Document more services and permissions of the cargo team (rust-lang/cargo#16402) - fix(new): Improve quality of package name error messages (rust-lang/cargo#16398) - feat(log): add more log events (rust-lang/cargo#16390) - chore: bump to 0.95.0; update changelog (rust-lang/cargo#16395) - Cache submodule into git db (rust-lang/cargo#16246) r? ghost
What does this PR try to resolve?
This PR adds an SVG renderer and allows users to choose between Canvas and SVG for rendering charts, which should hopefully resolve #8850.

Additional information
This does not guarantee a pixel-perfect match from the previous canvas-based solution, but I maintain it stays as close as possible.