vlib.x: add a go like benchmark, that estimates automatically how many iterations are needed, to get a statistically significant result #22215
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For my task, I need a benchmark that measures memory consumption. I checked the default benchmark library and didn't find that feature. So I decided to write it myself.
As advised in the Telegram chat, "just rewrite the golang library to vlang".
I checked the golang benchmark code and decided it was strange and overly complicated due to its use as a command-line tool.
So I decided to create my own library.
Basically, I copied the memory measurement logic and the prediction of the number of iterations from golang to estimate the expected benchmark evaluation time. And from vlang, I got the logic of using the benchmark as a library, not as a command-line tool.
How to use it:
But I'm not sure if I'm using the gc_heap_usage fields correctly. I was confused by the boehm_gc documentation, it's too hard for me. So if anyone can help me with that - you are welcome