TemplateValueField.message: def of bend-lint-rules@0.2.0.0 Import: import bend-lint-rules@0.2.0.0/performance/template_value_field.bend as TemplateValueField Lines 26-34 of bend-lint-rules@0.2.0.0/performance/template_value_field.bend: https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.0.0/performance/template_value_field.bend&start_line=26&end_line=34 import Base # Functions # ========= def message(+template: String, owner: String) -> String: template ++ " is a template, so reading it here builds its whole record, closures too, to read a part of it; and a record of functions passed as a template is built again at each use, so " ++ owner ++ " repeats this wherever its record is used, twice as often at each level of nesting. All lanes. Measured on a combinator nested 6 deep: 1.7 s against 1.0 s after the fix on the C lane, 49 s against 14 s on the JS lane; on a nested model, 6% of the time. Confidence: medium, as the fix moves the work to each read of the field. Make the field a function of Unit (`n: Unit -> U32`, built as `u => ..`), so that " ++ template ++ " is read only when the field is called. If the field is read about as often as the record is built, expect this finding." Uses (2): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append