Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to introduce an artificial delay between iterations #92

Closed
dead-claudia opened this issue Oct 6, 2024 · 4 comments
Closed

Comments

@dead-claudia
Copy link

I'd like to migrate away from the unmaintained Benchmark.js to this, and while this has almost everything I need, I need a way to introduce artificial delay, because I want to make sure it's actually tracking a fresh new frame each time.

That uses a fairly arbitrary delay, but ideally, this delay would be a function so I could pass it a () => new Promise(resolve => requestAnimationFrame(resolve)) function instead (as that's what I really need in practice).

@jerome-benoit jerome-benoit added enhancement New feature or request and removed enhancement New feature or request labels Oct 18, 2024
@jerome-benoit
Copy link
Collaborator

afterEach() hook is executed after each iteration.

@dead-claudia
Copy link
Author

@jerome-benoit Oh, I missed that. Thanks!

Unfortunately, I went a different route anyways, since I'm also benchmarking on browsers and I have to contend with its reduced resolution (which can be as low as 1ms) and I needed a hard guarantee that I was getting accurate timings in spite of it.

Also turned out to be pretty simple to roll, the hard part only being nailing down the right math for when to halt the test (I'm using a 99% confidence interval at the moment).

@jerome-benoit
Copy link
Collaborator

tinybench works on browser. And I doubt the timestamping is made differently on JS benchmarking tools around there.

@dead-claudia dead-claudia closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2024
@dead-claudia
Copy link
Author

dead-claudia commented Oct 18, 2024

Sorry, forgot to close.

@jerome-benoit I took a cursory glance in the code, and I suspect my listed concern isn't accounted for, but I'll need to walk through some math and collect a bunch of links before I can file a proper bug report. Edit: filed #143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants