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

linter: Reuse lint prepared query between lint runs #1230

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

charlieegan3
Copy link
Member

This allows aggregating linting and standard linting to use the same prepared query. This saves around 150ms on lint runs on my laptop.

This is done by using a single entrypoint with some input 'switches' to turn things on and off depending on the linter needs at that time and to stop things being run when they aren't required in the result.

This does not make a change to the LSP integration where this could be cached even between linter instances, but sharing this PR now to check the direction etc.

I get around 3%-4% total improvement for linting the regal bundle

…/regal main ➜ hyperfine --warmup 1 --runs 10 './regal-main lint bundle' './regal-new lint bundle'
Benchmark 1: ./regal-main lint bundle
  Time (mean ± σ):      3.974 s ±  0.073 s    [User: 22.025 s, System: 0.542 s]
  Range (min … max):    3.883 s …  4.096 s    10 runs

Benchmark 2: ./regal-new lint bundle
  Time (mean ± σ):      3.847 s ±  0.108 s    [User: 21.776 s, System: 0.521 s]
  Range (min … max):    3.735 s …  4.086 s    10 runs

Summary
  ./regal-new lint bundle ran
    1.03 ± 0.03 times faster than ./regal-main lint bundle

Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! 👏 150 ms shaved off from regal lint 😍

internal/embeds/schemas/regal-ast.json Show resolved Hide resolved
This allows aggregating linting and standard linting to use the same
prepared query. This saves around 150ms on lint runs on my laptop.

Signed-off-by: Charlie Egan <[email protected]>
@charlieegan3 charlieegan3 merged commit 731c8d2 into StyraInc:main Nov 4, 2024
4 checks passed
@charlieegan3 charlieegan3 deleted the share-lint-query branch November 4, 2024 13:43
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

Successfully merging this pull request may close these issues.

2 participants