diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-24 13:41:11 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-24 13:41:11 +0300 |
| commit | 9dd16cddc2d712c3aad0b0a5c8a5a1227e36a1c7 (patch) | |
| tree | 13f51329621b90cd688aa7ceb4dbd01e7dce8144 | |
| parent | 7cecd41384c8b4359b76b69ba2418145216b5545 (diff) | |
fix(rpn): remove duplicate ConstantsProvider initialization (task 4j)
NewOperations() no longer creates a ConstantsProvider internally since
NewRPN() always calls SetConstants() immediately after. Eliminates a
wasted allocation with no behavioral change.
| -rw-r--r-- | internal/rpn/operations.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/internal/rpn/operations.go b/internal/rpn/operations.go index 3dfc7c2..a3d660c 100644 --- a/internal/rpn/operations.go +++ b/internal/rpn/operations.go @@ -29,17 +29,15 @@ var ( ) // NewOperations creates a new Operations instance with the given variable store. -// Creates a new ConstantsProvider internally; use SetConstants to replace it. +// Does not create a ConstantsProvider internally; caller must use SetConstants. // If no registry is provided, defaults to the global MetricRegistry. func NewOperations(vars VariableStore, reg ...*MetricRegistry) *Operations { - consts := NewConstants() r := GetMetricRegistry() if len(reg) > 0 && reg[0] != nil { r = reg[0] } return &Operations{ vars: vars, - consts: consts, mode: FloatMode, // default prefixMode: SI, // default metricRegistry: r, |
