asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
333 stars 97 forks source link

Antora preview performance issues #907

Open alaindresse opened 3 weeks ago

alaindresse commented 3 weeks ago

Preview update performance is excessively slow (minutes to update a preview on an M1 Pro mac when the source is changed) in large repos with many symlinks (e.g. for nx monorepos with react-native apps and libs).

Using the proposed APIs for findFiles greatly improves the situation, but until that API is finalized, it can only be used with code insiders and it cannot be used in an extension published to the marketplace.

alaindresse commented 1 week ago

@ggrossetie a couple things I've seen in the code that might have an impact on performance.

ggrossetie commented 1 week ago

reading all files from modules/*/{attachments,examples,images,pages,partials,assets}/** for all antora folders. Is that necessary ?

I think we could potentially lazy load contents (i.e., load contents when we actually need it) but we need to retrieve all the files in order to build a "complete" content catalog.

alaindresse commented 1 week ago

reading all files from modules/*/{attachments,examples,images,pages,partials,assets}/** for all antora folders. Is that necessary ?

I think we could potentially lazy load contents (i.e., load contents when we actually need it) but we need to retrieve all the files in order to build a "complete" content catalog.

I was indeed referring to lazy loading the contents. The list of files is clearly needed for suggestions and completion.

ggrossetie commented 1 week ago

I was indeed referring to lazy loading the contents. The list of files is clearly needed for suggestions and completion.

I think that's an excellent idea, feel free to submit a pull request to lazy load the contents

ggrossetie commented 1 week ago

I remember now, include processor must be synchronous in Asciidoctor. So we cannot use vscode.workspace.fs.readFile(file) since it's an asynchronous function. I think that's the reason why we are eagerly loading contents.

alaindresse commented 1 week ago

What I would consider: