-
-
Notifications
You must be signed in to change notification settings - Fork 767
Scale nodes by file size #351
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
base: master
Are you sure you want to change the base?
Conversation
5ba8bc7 to
193af0e
Compare
|
Cool looking feature. Thanks for the detailed overview of the changes. |
193af0e to
813c3d8
Compare
813c3d8 to
da2c52a
Compare
|
I have now had some time to test the PR a bit more and I think the physics in particular needs some more tweaking before it could be deemed "stable". Examples:
That being said, it still works fine for most common projects I have tested it on. I have some ideas on how to stabilize it somewhat. Like adding adding an outward force or a more "spring like" gravity model. For now I made a few changes to the PR:
I will try to improve it and report back. |
| if (gGourceSettings.scale_by_file_size) { | ||
| for (RFile* f : files) { | ||
| if (!f->isHidden()) { | ||
| float r = f->getSize() / 2.0f; |
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.
So this sets the radius to file size. It means the actual dot size will be proportional to file size squared. The area of the dots will not be proportional to file size.
src/formats/git.cpp
Outdated
|
|
||
| if (gGourceSettings.scale_by_file_size && status != "D") { | ||
| char cmd_buff[2048]; | ||
| int written = snprintf(cmd_buff, 2048, "git --git-dir=%s/.git --work-tree=%s cat-file -s %s", m_repository_path.c_str(), m_repository_path.c_str(), dst_blob.c_str()); |
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.
This seems to cause a performance issue doing this here as it blocks the UI while fetching the blob. Also this wont work if logfile is a file and not a directory. You can also see it block when you move the mouse cursor of the interactive timeline as it peeks at the part of the log under the cursor to get the timestamp.
I think for performance instead what would be good is we get all the file blob sizes up front (maybe just get every blob file size in the repo at once) right after we generate the git log, puts them into a data structure, and then we can look up into it here.
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.
Implemented. I removed per-event git cat-file calls and replaced them with a one-time blob-size index build right after log generation, then O(1) lookups during parsing. Should avoid timeline-hover/UI stalls... I think. Maybe needs more testing.
da2c52a to
2f37fb7
Compare
|
I updated the branch to make the "physics layout" more stable and took in some some review feedback. Main improvements since earlier revisions:
Updated my OP to reflect the changes, also added a new video. Some behavior should maybe be changed? As in distance between directories (clusters)? Might do a bit more testing but it seems pretty nice all in all right now! |
Summary
This PR adds optional file-node scaling by file size via
-S/--scale-by-file-size.When
-Sis not set, existing Gource behavior is unchanged.Related issues: #91 #54 #147 #223
Screencast.from.2026-02-10.17.22.23_trimmed.webm
What changed
-S/--scale-by-file-size).--show-file-size-on-hover).Git size lookup changes
git cat-file --batch-all-objects --batch-check='%(objectname) %(objecttype) %(objectsize)'--abbrev=40so blob hashes match the prebuilt index.Custom log format
Custom log supports optional
file_sizeas a 6th field:timestamp|username|type|file|colour|file_sizefile_sizeis used forA/Mactions.CLI/options added
Primary feature flag:
-S,--scale-by-file-sizeAdvanced tuning options:
--file-scale--dir-spacing--file-gravity--file-repulsion--show-file-size-on-hoverDefaults are tuned so
-Sworks reasonably without extra tuning.Notes
Current scaling uses a logarithmic mapping for readability across large size ranges.