Ideas around benchmarking in tests #879
Quantumplation
started this conversation in
Core language features
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The recent implementation of
label
for the property based testing gave me some inspiration.For those not familiar, the way the
label
works internally is by prefixing the trace with a certain non-printable character that is unlikely to appear in normal traces; It can then pick this up, and handle it specially during property tests.A similar trick could be used to trace out the spent budget:
Prints out some non-printable trace statement; when the emulator sees that trace, it can make a note of the current budget, and then when printing out the traces later, print out the budget as of that line.
Similarly, you could do
Which the emulator can then substitute the ending line with the difference between the spent budget at those two nodes.
A more robust implementation would be to have a set of
test only
builtins that are purpose built for these tasks. This could be useful for other things in general, like debugger breakpoints, aiken-line-number traces, etc. They get omitted when compiling the code in release mode, but appear when compiling for tests or for debugging.Beta Was this translation helpful? Give feedback.
All reactions