-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Speedup the VizIR HTML. #7713
Speedup the VizIR HTML. #7713
Conversation
This CodeMirror thing to just show (not edit!) the assembly (without syntax highlighting) is super expensive and slow. Added functionality is low, IMHO. |
Additionally, Further, I removed the use of CodeMirror, and use a lightweight, very fast syntax highlighter called Speed-Highlight, which actually also colors the code nicely: Jump to assembly still works. I did some code reordering to reduce additional layout recomputations as well. Additionally, I flattened out the As a bonus, I cleaned up the dragging of the "resizerBars" that separates the 3 panes. Every time you clicked the bar, a NEW event listener is added to the document. This is now fixed. As a second bonus, instead of making the "Jump To IR Viz" button jump to the label, I jumped to the parent box, which is much clearer once you move it. Overall performance profile now looks like this upon loading: |
…s regarding the StmtViz.
By the way, question: there seems to be two instances of bootstrap loaded: Halide/src/irvisualizer/StmtToViz_dependencies.template.html Lines 4 to 7 in c9bf3b1
Once |
Tagging @darya-ver , the original author of #7056 . |
https://stackoverflow.com/a/60665404/155137 They seem to contain the same base, but the bundle has extras. When I have some time, I might try it without the bundle, to see if the more ligthweight version works. Additionally, I would like to check if I can add the functionality to immediately jump to the assembly as well, straight from the statement code (instead of having to go through the IR viz pane). |
(I assume this is still a work-in-progress?) |
Not actively working on it anymore. I propose we merge this, and if I get to it again, and I add that feature (if possible) to jump directly from IR to assembly, I'll open another PR. |
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.
LGTM pending green
Hi @mcourteaux , Chiming in... What prevents us from nesting the tooltip tag inside the The nested approach seems to enable a pure CSS implementation, completely eliminating the overhead you indicated earlier. Example. --- StmtToViz.cpp 2023-08-03 09:44:27.598731408 -0700
+++ StmtToViz-1.cpp 2023-08-03 09:53:59.492905354 -0700
@@ -1260,14 +1260,13 @@
}
stream << "<div id='" << id << "' class='cost-btn CostColor" << line_costc << "'"
- << " aria-describedby='tooltip-" << id << "'"
<< " line-cost='" << line_cost << "' block-cost='" << block_cost << "'"
<< " line-cost-color='" << line_costc << "' block-cost-color='" << block_costc << "'>"
- << "</div>";
-
- stream << "<span id='tooltip-" << id << "' class='tooltip cond-tooltop' role='tooltip-" << id << "'>"
+ << "<span id='tooltip-" << id << "' class='tooltip cond-tooltop' role='tooltip-" << id << "'>"
<< prefix << line_cost
<< "</span>";
+ << "</div>";
+
}
/* Misc utility methods */ |
I definitely like this, however, the current implementation supports clicking some things, such that the tooltip stays, instead of only being visible on hover. I personally don't see the use in that, so I would be definitely in favor of a pure-CSS approach. |
Also, I believe the tooltips are used to accumulate the cost of the whole subtree under the node that it currently serves as a tooltip for. This tooltip value changes depending on whether the node is collapsed or expanded. Expanded only shows the "self" value, and when collapsed it shows the full subtree cost. This is not CSS-onlyable. |
Although, that doesn't prevent the tooltip appearing/disappearing mechanism to be fully CSS. It's just the content of the tooltip that is determined by the JS code. Not a bad idea after all, I think. |
@steven-johnson I don't see what the build issue is on the buildbot/Windows. Am I the blame? I really can't tell from that output. |
No, that Windows buildbot is just flaky bag of poo, but we don't currently have any budget to replace it. (Donations welcome!) Ready to land, thanks! |
I would love to hear if anybody feels the speed difference. Open an HTML stmt-file you might already have, then regenerate using a new Halide build with the merged PR, rebuild your generator, and rerun the generator and reopen the new file. For me, it literally went from 15+ seconds to 1 to 2 seconds for heavy files. |
Wonderful -- I have some benchmarks that I tested the original implementation on. I'll review this PR and post benchmark results over the weekend! |
@mcourteaux The rendering is definitely much faster now. Prior to this PR, chrome failed to load the html file for the |
Amazing news! 🥳 It still is for like a second unresponsive every time you resize the panes, but I couldn't figure out how to fix that. |
Tagging this with release notes so that we remember to list the improvements to the visualizer. |
* From 12s to 2s, by eliminating the bulk of the $() calls. * Speed up recursive depth function by not using jQuery. * Changed out CodeMirror for Speed-Highlight. Additionally several fixes regarding the StmtViz. --------- Co-authored-by: Steven Johnson <[email protected]>
Read comments below to follow along. Overall, for my large Stmt HTML file, I got the time down from close to 15s to less than 2s.