Skip to content

Performance issue: top-level field value evaluated twiceΒ #1759

@bozaro

Description

@bozaro

Bug Report

Performance issue: top-level field value evaluated twice.

1. Minimal reproduce step (Required)

kcl run for file:

show = lambda s -> str {
    print("show: ${s}")
    s
}

# `_foo` usage before declaration
foo = _foo

_foo = {
    name: "foo"
    value: show("foo")
}

_bar = {
    name: "bar"
    value: show("bar")
}

# `_bar` usage after declaration
bar = _bar

2. What did you expect to see? (Required)

I expect single show: foo and show: bar lines:

show: foo
show: bar
foo:
  name: foo
  value: foo
bar:
  name: bar
  value: bar

3. What did you see instead (Required)

show: foo
show: foo
show: bar
foo:
  name: foo
  value: foo
bar:
  name: bar
  value: bar

4. What is your KCL components version? (Required)

0.10.9-linux-amd64

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions