deno icon indicating copy to clipboard operation
deno copied to clipboard

Bench: setup and cleanup

Open sgwilym opened this issue 2 years ago • 2 comments

If you're writing benchmarks which use some kind of resource (e.g. benching writes to a Sqlite database), there's no way to cleanup that resource after all benchmarks have run.

  • The naive approach of simply doing what you need to cleanup after calling Deno.bench doesn't work.
  • Listening for window.unload doesn't accommodate anything async.

sgwilym avatar May 06 '22 08:05 sgwilym

This would also be nice to do per bench. As far as I know, there's no way to set something up and tear it down per bench either without that time of that setup / teardown being counted towards the bench.

sgwilym avatar May 17 '22 08:05 sgwilym

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 21 '22 05:07 stale[bot]

Could this be reopened? I still find myself wanting this feature.

For example: I am trying to benchmark the synchronisation of the contents of two tree structures. Every time a bench is performed, a new (unsynced) tree must be instantiated from scratch. I would like to bench only the syncing, and not the instantiation of the tree.

sgwilym avatar Oct 13 '22 12:10 sgwilym

Hello I'm back again and finding that I'd still like a way to perform some setup / teardown with each bench without including the time taken to perform that setup/teardown in the bench itself.

sgwilym avatar Jan 20 '23 15:01 sgwilym