-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
stable color rendering #501
Conversation
|
Thanks for opening a PR! This is indeed an interesting approach. The loops look a tad scary to me, as I don't know how they would perform with large graphs. I also am not sure if there is no way an infinite loop could happen there. Is there a way to get some data to the graph data object itself that could be used for this purpose with less likelihood for a performance hit? |
Thanks for taking the time to review @valscion! Quick time complexity analysis just to make sure we are on the same page. I assume you are talking about It is almost entirely bounded by the number of chunks, secondarily the number of parts of the most complex file name. So if there are 100 chunks and the most complex file name is
The only thing I really see as performance impacting is if a user has a ton of chunks, realistically that's the only variable that affects time complexity in a realistic way here. But if someone has a few hundred chunks, the canvas rendering will also be impacted by having to compute the layout of all of those chunks too. I'd suspect this function's additional performance hit wouldn't be noticeable in comparison. The only place I can see an infinite loop being possible is in Let me know if we are on the same page here and if you want me to make any edits or run any tests to make sure this is working correctly at scale. |
Thanks for the additional information 😊 good point about the count of chunks impacting the layout calculation anyway. I have been able to only glance at the code on mobile so far so I haven't yet been able to do a more thorough review. |
@valscion have you been able to take a look? This seems like a valuable improvement that would be great to get merged! :) |
Sorry, this is still pending. I'm currently on paternal leave so I have little time to spend on computer 😊 |
Hi @CreativeTechGuy! I'm still on parental leave, so I haven't yet had a chance on checking this out. I haven't forgotten about this PR, though, and will get back to this once I have more time |
OK I now took a look here. This indeed makes figuring out which chunks changed in size much easier than before! I ran a simple test with our application where I added a lot of extra strings to a single module to make it grow in size and then looked at the differences before and after: Without this PRBeforeAfterNotesIt's quite difficult to see that the chunk containing With this PRBeforeAfterNotesI can now spot which chunks changed place and can spot that the |
The only consideration I have in here is that the choice of colors now is quite bright and hides some details in some places that the FoamTree built-in color algorithm was able to discover: Compare that to the original version (the chunk contents are the same) and you can see that there are more details immediately visible before this PR: So I wonder is there a way to tweak the color deciding algorithm to get a bit more muted colors so that they'd be easier on the eye and also be able to see the count of sub-modules more easily? |
I'd argue that the colors in the original version are just as similar (see the huge cluster of similar teals in the bottom right) but it is just more noticeable now that the colors are more vibrant. I'm not sure there's simply enough colors which are visually distinct enough to avoid this problem. I'll work on making the colors more muted. Although I think that the more muted the colors are, the more that will start to look visually similar. In my testing, as we reduce the saturation on the colors, it starts to look "disabled" so I don't want to mute them too much that it starts to communicate some functional state which would be misleading. |
Oh wow this looks much nicer! I see no reason why we would not be able to ship this soon. Do you think this feature warrants a small mention in the README.md or is it OK to leave undocumented? Adding a changelog entry at least would be nice |
Got it! Rebased with master and added a line to the Changelog! I'm not sure about documenting this. It's not configurable and shouldn't break anything. Also, if someone doesn't understand it and just thinks they are random, then there's no harm. Worst case it's the same as it was previously, best case it's an improvement. :) |
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! This looks great to me! 👍
This has now been released in v4.6.0 |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) | devDependencies | minor | [`4.5.0` -> `4.6.0`](https://renovatebot.com/diffs/npm/webpack-bundle-analyzer/4.5.0/4.6.0) | --- ### Release Notes <details> <summary>webpack-contrib/webpack-bundle-analyzer</summary> ### [`v4.6.0`](https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/HEAD/CHANGELOG.md#​460) [Compare Source](webpack-contrib/webpack-bundle-analyzer@v4.5.0...v4.6.0) - **New Feature** - Support outputting different URL in server mode ([#​520](webpack-contrib/webpack-bundle-analyzer#520) by [@​southorange1228](https://github.com/southorange1228)) - Use deterministic chunk colors (#[501](webpack-contrib/webpack-bundle-analyzer#501) by [@​CreativeTechGuy](https://github.com/CreativeTechGuy)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xNjUuMSIsInVwZGF0ZWRJblZlciI6IjMyLjE2NS4xIn0=--> Co-authored-by: cabr2-bot <[email protected]> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1513 Reviewed-by: Epsilon_02 <[email protected]> Co-authored-by: Calciumdibromid Bot <[email protected]> Co-committed-by: Calciumdibromid Bot <[email protected]>
Fixes #500
There's a ton of variance in how users may configure their chunk names. To ensure stable colors, we need to dynamically identify which (if any) part of the file name is the unique "name" part and use that to determine the colors. If that cannot be identified or if a file doesn't follow the pattern of the rest, the entire file name will be used.
Given that the behavior before was random rainbow colors all the time (colors would even change when zooming/hiding) this is better even in the case where nothing can be uniquely identified. So I'd argue that while this is an imperfect solution, it's better in all cases than what was there by default.
This is best visualized with photos of the different cases:
Before this PR:
After this PR (when unique name can be identified):
After this PR (when unique name can be identified - with chunk contents changed but colors are still stable with above):
After this PR (with no identifiable parts of the filename - deterministic but effectively random colors):