Repository navigation
Speed up API page regeneration in serve to under 4 seconds #4322
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
Merged
akira28
merged 4 commits into
dev/api-pages-hot-reload
from
dev/api-render-parallel-pages
Oct 6, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
882842a
Render every irregular space in a paragraph as a space
akira28 80942de
Cut serve API page regeneration from about 10 s to under 4 s
akira28 f7b6db5
Emit the irregular-space hint once per file per build
akira28 bd47520
Retry a failed version index fetch on the next serve regeneration
akira28 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Licensed to Elasticsearch B.V under one or more agreements. | ||
| // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
| // See the LICENSE file in the project root for more information | ||
|
|
||
| using System.Collections.Concurrent; | ||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace Elastic.ApiExplorer.Model; | ||
|
|
||
| /// <summary> | ||
| /// Downloaded spec bodies keyed by object key. Lives longer than any one <see cref="VersionIndexClient"/>, | ||
| /// so <c>serve</c> can re-fetch the version index on each regeneration but skip re-downloading specs. | ||
| /// </summary> | ||
| public sealed class SpecBodyCache | ||
| { | ||
| private readonly ConcurrentDictionary<string, byte[]> _bodies = new(StringComparer.Ordinal); | ||
|
|
||
| internal bool TryGet(string objectKey, [NotNullWhen(true)] out byte[]? body) => _bodies.TryGetValue(objectKey, out body); | ||
|
|
||
| internal byte[] GetOrAdd(string objectKey, byte[] body) => _bodies.GetOrAdd(objectKey, body); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick uppercase env vars :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would, but the runtime reads this one case-sensitively on Linux and macOS. A one-line app that prints
GCSettings.IsServerGCshowsTrueforDOTNET_gcServer=1, andFalseforDOTNET_GCSERVER=1andDOTNET_GCserver=1. Uppercasing it would silently turn server GC off. I added a comment in the compose file saying so (f7b6db5).