Involved Source Filesarithmetic.gooptimization.go Package limits provides the engine's topology ceilings and reusable work
accounting primitives. It deliberately has no dependency on graph, layout,
or routing types so every layout domain can consume the same limits without
introducing package cycles.
Package-Level Type Names (total 2)
/* sort by: | */
OptimizationWorkGuard accounts one complete hierarchy or placement
optimization. The limit is an explicit ceiling; zero permits cancellation
checks but no charged work. Add charges amount optimization work units. AddProduct multiplies two work dimensions without allowing arithmetic
overflow. AddSort charges the comparison bound for sorting length values. Check observes optimization cancellation immediately. Finish observes cancellation at an optimization boundary. Location returns the operation name used in diagnostics. Step charges one optimization work unit. Used returns the accepted work units.
*OptimizationWorkGuard : github.com/pancsta/d2/d2layouts/d2talalayout/internal/graphbounds.WorkStepper
*OptimizationWorkGuard : github.com/pancsta/d2/d2layouts/d2talalayout/internal/layoutgraph.SharedWorkStepper
func NewOptimizationWorkGuard(ctx context.Context, location string, limit uint64) (*OptimizationWorkGuard, error)
func Shuffle[T](values []T, random *rand.Rand, guard *OptimizationWorkGuard) error
CheckedAddUint64 returns a+b and whether the sum fits in uint64.
CheckedMulUint64 returns a*b and whether the product fits in uint64.
NewOptimizationWorkGuard constructs a guard and observes cancellation before
any optimization work begins.
NewWorkGuard constructs a work guard and observes cancellation before any
operation work begins.
Type Parameters:
T: any Shuffle is math/rand.Shuffle's Fisher-Yates implementation with a guard
check before every random draw. Its reduction algorithm and draw order are
intentionally identical so seeded layout output remains stable.
Package-Level Variables (only one)
ErrOptimizationResourceLimit reports exhausted or overflowing optimization
work accounting.
Package-Level Constants (total 12)
MaxBinPackWorkUnits spans the complete recursive bin-packing operation,
including speculative transactions and route scans.
MaxEngineEdges is the largest edge count the engine processes in one attempt.
MaxEngineNodes is the largest node count the engine processes in one attempt.
MaxEngineRoutePoints bounds aggregate route storage throughout the engine.
MaxEngineTreeDepth bounds recursive topology throughout the engine.
MaxEngineWorkUnits is the default aggregate work budget for a graph.
MaxGraphSize is the maximum supported width or height at a pipeline stage
boundary.
MaxLabelPlacementWorkUnits bounds the quadratic overlap and candidate
search performed while positioning labels and icons.
MaxOptimizationWorkUnits bounds one hierarchy or placement optimization.
MaxPlaceTreesWorkUnits is calibrated for the superlinear candidate and
obstacle work performed by tree placement.
MaxTransactionOverlapReferences bounds retained existing-overlap
references. Exceptions are retained in both directions because hot
placement checks key by the moved node.
MaxTransactionWorkUnits allows a complete layout transaction to compare
many nearby placements without resetting the ordinary engine budget for
every candidate.
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.