mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
[PR #915] [MERGED] Optimization: execute const object bodies and typechecks only once #801
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/915
Author: @bioball
Created: 1/29/2025
Status: ✅ Merged
Merged: 1/29/2025
Merged by: @bioball
Base:
main← Head:const-member-optimization📝 Commits (1)
5bd4ef5Optimization: execute const object bodies and typechecks only once📊 Changes
3 files changed (+37 additions, -0 deletions)
View changed files
📝
pkl-core/src/main/java/org/pkl/core/runtime/VmUtils.java(+12 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/basic/constModifier5.pkl(+13 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/basic/constModifier5.err(+12 -0)📄 Description
Closes https://github.com/apple/pkl/issues/508
If the object member is const, it only needs to be executed once, and all children in the prototype chain can use its cached value.
There is a possible other optimization here, not included in this PR: we can avoid adding these values to the child object's
cachedMembers.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.