-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
chore: codspeed benchmark #12347
chore: codspeed benchmark #12347
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if we can avoid duplicating the code for the benchmarks, but happy to try something out first.
Also a bit concerned with this running on each push to the pull request, maybe if can run only if there's a label. But also not a blocker
*/ | ||
export async function run(projectDir, outputFile) { | ||
export async function run(projectDir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable wasn't used
That would kill the purpose of this tool. Maybe we could evaluate a reduced workload for these benchmarks |
This is weird, it works locally, but it fails in CI: https://github.com/withastro/astro/actions/runs/11683003640/job/32531309684?pr=12347 |
I tested and it also works locally. I can't tell what's going on here, there's no output or errors from the preview command at all in CI. It's either the command not running at all, or it's hanging. I'm also reading the tinybench code and it seems to be running the benchmark repeatedly instead of once, so locally it took very long to finish. I assume this is only temporary, but could a better way be using our own benchmark code and then reporting the results to codspeed ourselves manually? I wonder if this CI issue we're seeing is related to tinybench specifically since we know it should be working when we run |
This is actually expected by a benching library. Other libraries, in other ecosystems too, behave the same way. They run multiple times with the same function/task so they can create a sample out of it. I'll try to use vitest at this point. |
I guess that makes sense for our benchmarks like What we also want is to measure are things like "average render time for MDX pages" or "requests/sec for Astro pages". If we wrap with tinybench, we're instead measuring "how long it takes to benchmark the 'average render time for MDX pages'" (for example). I'm ok with testing |
I changed the approach now and removed the need for a preview server to test the rendering. I created an adapter that is very similar to our test adapter, we create a This makes sense for rendering because it removes the noise of a Node.js HTTP server. With this approach, we use the minimal |
CodSpeed Performance ReportCongrats! CodSpeed is installed 🎉
You will start to see performance impacts in the reports once the benchmarks are run from your default branch.
|
I am going to merge this for now. We will have a discussion internally about what to benchmark and how, so things might change |
Changes
This PR creates a new workflow to use continuous benchmarking using CodSpeed
Everything was set up months ago, but I couldn't follow up.
I resurrected the code, tested it locally, and now opened it.
I created a new workflow because I don't want to disrupt too much the existing workflow we use for inline benchmarking via magic command.
Once we are in a place where CodSpeed is usable, I believe we can start using that one and ditch the ones that we use via command (only the workflow, of course).
Testing
I tested the scripts locally, and they work.
CI should pass. Then, upon merging the CI should trigger benchmarking and upload the results in the dashboard. The next, rebase PR, should show a bot message.
Docs
N/A