Skip to content

Conversation

@ematipico
Copy link
Member

@ematipico ematipico commented May 17, 2025

Summary

This PR fixes an issue where the Daemon eat a lot of memory during the first scanning session.

Closes biomejs/biome-zed#107
Closes #6058

Scanner

The issue was caused by the fact that the scanner didn't check if a file is ignored before opening the file itself. If a file is ignored, Biome shouldn't care. The thing is, we need to check this only after we compute configuration files and ignore files. The was has been added inside the function open_file inside scanner.rs.

Also, I removed a Vec::with_capacity, because we were creating a vector that contained more items than it should. A small win.

LSP

Similarly, the LSP shouldn't open and store documents that are ignored. So now we check that inside text_document::did_open. All methods that require opening a document, now they check if the document exists inside documents, and we bail early (no error), if a document isn't there.

BiomePath

The kind of BiomePath isn't a bitflag anymore. We don't use it semantically, because the priority that we create for the first time is always one, and we never assign multiple flags. A small win.

Dome

As for now, I removed the usage of Dome because it's useless for now. It's not slow, but evaluated_paths is already a BTreeSet, so there's no reason to create an ad-hoc iterator.

Test Plan

Added a new test. Tested it manually many times. Used the ecosystem CI extensively.

@github-actions github-actions bot added A-CLI Area: CLI A-Core Area: core A-Project Area: project A-Parser Area: parser A-LSP Area: language server protocol L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages L-Grit Language: GritQL labels May 17, 2025
@github-actions
Copy link
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 50558 50558 0
Passed 49243 49243 0
Failed 1315 1315 0
Panics 0 0 0
Coverage 97.40% 97.40% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6650 6650 0
Passed 2229 2229 0
Failed 4421 4421 0
Panics 0 0 0
Coverage 33.52% 33.52% 0.00%

ts/babel

Test result main count This PR count Difference
Total 812 812 0
Passed 722 722 0
Failed 90 90 0
Panics 0 0 0
Coverage 88.92% 88.92% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18705 18705 0
Passed 14351 14351 0
Failed 4354 4354 0
Panics 0 0 0
Coverage 76.72% 76.72% 0.00%

@codspeed-hq
Copy link

codspeed-hq bot commented May 17, 2025

CodSpeed Performance Report

Merging #6052 will not alter performance

Comparing fix/correctly-compute-ignored-files (df117c8) with main (64ca243)

Summary

✅ 94 untouched benchmarks
🆕 1 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 html_formatter[index_1033418810622582172.html] N/A 462.2 µs N/A

@arendjr
Copy link
Contributor

arendjr commented May 18, 2025

Good stuff! Haven't looked at the test failures yet though 😅

@ematipico ematipico force-pushed the fix/correctly-compute-ignored-files branch from 69db053 to b585a9e Compare May 18, 2025 12:28
@ematipico ematipico force-pushed the fix/correctly-compute-ignored-files branch from b2c29df to 02ee2bb Compare May 19, 2025 09:11
@ematipico ematipico marked this pull request as ready for review May 19, 2025 09:19
@ematipico ematipico requested review from a team May 19, 2025 09:21
Copy link
Contributor

@arendjr arendjr left a comment

Choose a reason for hiding this comment

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

Amazing work 🙇

@ematipico ematipico merged commit 4309234 into main May 19, 2025
13 checks passed
@ematipico ematipico deleted the fix/correctly-compute-ignored-files branch May 19, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Core Area: core A-LSP Area: language server protocol A-Parser Area: parser A-Project Area: project L-Grit Language: GritQL L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages

Projects

None yet

3 participants