Skip to content
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

Performance issue: KCL evaluates unused package fields #1758

Open
bozaro opened this issue Nov 19, 2024 · 0 comments
Open

Performance issue: KCL evaluates unused package fields #1758

bozaro opened this issue Nov 19, 2024 · 0 comments
Assignees
Labels

Comments

@bozaro
Copy link
Contributor

bozaro commented Nov 19, 2024

Bug Report

Performance issue: KCL evaluates unused package fields.

1. Minimal reproduce step (Required)

Run script:

#!/bin/sh

mkdir -p unused_pkg

cat > kcl.mod <<EOF
[package]
name = "__main__"
edition = "0.0.1"
version = "0.0.1"
EOF

cat > main.k  <<EOF
import unused_pkg
EOF

cat > unused_pkg/data.k <<EOF
show = lambda s -> str {
    print(s)
    s
}

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

kcl run .

This script creates files:

  • kcl.mod
    [package]
    name = "__main__"
    edition = "0.0.1"
    version = "0.0.1"
    
  • main.k
    import unused_pkg
    
  • unused_pkg/data.k
    show = lambda s -> str {
        print(s)
        s
    }
    
    foo = {
        name: "foo"
        value: show("foo")
    }
    

And run main.k.

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

I expect that top-level unused variables is lazy evaluated.

{}

3. What did you see instead (Required)

I see labmda output on unused top-level variable evaluation.

foo
{}

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

0.10.9-linux-amd64
@Peefy Peefy self-assigned this Nov 20, 2024
@Peefy Peefy added this to the v0.11.0 Release milestone Nov 20, 2024
@Peefy Peefy added enhancement New feature or request evaluator resolver labels Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants