Skip to content

perf: don't gate indexing on compliation completing - #769

Open
scohen wants to merge 3 commits into
mainfrom
scohen/remove-index-lock
Open

perf: don't gate indexing on compliation completing#769
scohen wants to merge 3 commits into
mainfrom
scohen/remove-index-lock

Conversation

@scohen

@scohen scohen commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

When reindex was run at the same time as compilation, it caused something in the BEAM vm to soak up CPU. This was a permanent condition that would affect the project node until it was restarted.

Since we swapped out the ETS based index backend for a SQLite one, we should be able to reindex and compile at the same time. This will dramatically reduce the amount of time the project node takes to boot.

This change makes it so indexing and compilation occur at the same time, and we fix up the index after compilation completes

@scohen
scohen requested a review from doorgan July 9, 2026 01:28
@scohen
scohen force-pushed the scohen/remove-index-lock branch from 55401f7 to e9b5658 Compare July 9, 2026 17:50
@doorgan

doorgan commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Maybe I'm missing something, I deleted .expert to force an initial compilation and indexing. Compilation starts, but indexing does not. When I use the "reindex" command I get a log for project reindex requested but it still waits for the compilation to finish

@scohen

scohen commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@doorgan are you sure? When I run this with a clean build and index, I see progress for compilation and indexing happening at the same time, in the status bar, I see Compiling foo.ex | Indexing 86% Are you not seeing that?

@doorgan

doorgan commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Yes, here is a recording. After deleting .expert, it does a full compile, finishes, then kicks the indexing:

compile.indexing.compressed.mp4

If I request reindexing while compilation happens it's the same, it waits for compilation to finish

compile.reindex.compressed.mp4

@katafrakt

Copy link
Copy Markdown
Member

I tested this too. On Expert repo, when open at root, I have seen something that looked like indexing parallel to compilation (but maybe it was for different apps), but on two other projects it was very clearly indexing after compilation finished.

@scohen

scohen commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

What's happening is that the new indexer needs the builds paths from mix, and that reintroduces the mix lock. Since the build starts before the indexer, the indexer needs to wait.

scohen added 3 commits July 20, 2026 19:10
When reindex was run at the same time as compilation, it caused
something in the BEAM vm to soak up CPU. This was a permanent
condition that would affect the project node until it was restarted.

Since we swapped out the ETS based index backend for a SQLite one, we
should be able to reindex and compile at the same time. This will
dramatically reduce the amount of time the project node takes to boot.

This change makes it so indexing and compilation occur at the same time,
and we fix up the index after compilation completes
The test was asserting something that is no longer true
@scohen
scohen force-pushed the scohen/remove-index-lock branch from e9b5658 to 3860ae2 Compare July 21, 2026 02:10
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.

3 participants