-
Notifications
You must be signed in to change notification settings - Fork 449
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
improve grid layout #1263
improve grid layout #1263
Conversation
// skip options with a row that is 1.2*longer or shorter | ||
// Note: we want a low threshold to explore good options within attemptLimit, | ||
// but the best option may require a few rows that are far from the target size. | ||
okThreshold := 1.2 |
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.
why 1.2?
// but the best option may require a few rows that are far from the target size. | ||
okThreshold := 1.2 | ||
// if we don't find a layout try 25% larger threshold | ||
thresholdStep := 0.25 |
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 think the convention is to have this as a constant
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.
var bestLayout [][]*d2graph.Object | ||
bestDist := math.MaxFloat64 | ||
count := 0 | ||
attemptLimit := 100_000 |
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.
constant
divisions = append(divisions, append(inner, index-1)) | ||
} | ||
iterDivisions(objects[:index], nCuts-1, func(inner []int) bool { | ||
done = f(append(inner, index-1)) |
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 wonder if these could end up with those issues of slice references since you're expanding it recursively
Summary
Improves performance of grid layout with many objects and rows/columns, and improves even expanding of smaller objects in grid layout.
Details
./ci/e2ereport.sh
with-memprofile
or-v
being ineffective due to empty cpuprofile argument before itnew slow_grid test
new grid_oom test (with improved object scaling)
new grid_even test
grid_oom test before improving object scaling
previously the smallest node
e
would grow first becoming larger thanc
andd
now these are scaled evenly