Skip to content

perf(linter/vitest): speed up checking a call if it is a valid vitest call #11384

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented May 30, 2025

The valid vitest calls are generated according to combination rules, see vitest-dev/eslint-plugin-vitest#276 so that we can simplify it by checking the possible combination rather than checking all possible methods, which can avoid an expensive action String::join.

The reason why I did this is that I found the biome has a similar checking algorithm, and it also needed to be used in the formatter. So I am looking at our implementation to check whether we can use the same method in both the linter and the formatter in our codebase. So far, I have found that both Biome and Oxlint have a little difference in the check. I don't know what makes the difference, and I won't dig into it for now. I will revisit when most of the formatting work is done.

Copy link
Member Author

Dunqing commented May 30, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance labels May 30, 2025
Copy link

codspeed-hq bot commented May 30, 2025

CodSpeed Instrumentation Performance Report

Merging #11384 will not alter performance

Comparing 05-30-perf_linter_vitest_speed_up_checking_a_call_if_it_is_a_valid_vitest_call (b6b2779) with main (1cd8b9c)

Summary

✅ 38 untouched benchmarks

@Dunqing
Copy link
Member Author

Dunqing commented May 30, 2025

The Linter benchmark doesn't enable the Vitest plugin, so no performance change. Also, I've run in VScode repo on my local, and there seems to be no difference; the reason may be that most of the test call methods are only a single identifier(test) rather an member expression (test.todo.skip), so the String::join is quite cheaper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant