Skip to content

Conversation

@stackoverflow
Copy link
Contributor

Power assertions have a big impact in the runtime performance of Pkl (~2x). This is negligible in most scenarios, but in some cases the performance lost is unacceptable.
This PR adds a flag to pkl eval and pkl test: --power-assertions.
This flag is enabled by default for pkl test and disabled by default for pkl eval.
Users can decide by themselves if they want it or not.

names = arrayOf("--power-assertions"),
help = "Enable power assertions for detailed assertion failure messages.",
)
.flag()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ease copy/paste of options between test and eval commands, it might be nice to also support --no-power-assertions here

Suggested change
.flag()
.flag("--no-power-assertions", default = false, defaultForHelp = "disabled")
return holder.traceMode;
}

public boolean getPowerAssertions() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: naming?

Suggested change
public boolean getPowerAssertions() {
public boolean getPowerAssertionsEnabled() {
@StefMa
Copy link
Contributor

StefMa commented Jan 31, 2026

Don't we better figure out why the performance drops and fix it? 🤔

@HT154
Copy link
Contributor

HT154 commented Jan 31, 2026

Don't we better figure out why the performance drops and fix it? 🤔

Natch. We understand why it happens and are looking into how to best resolve it.

Either way, I think it's still valuable to have an option for this so that users with large test suites can disable power assertions for a performance boost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants