-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
perf(compile): code cache #26528
perf(compile): code cache #26528
Conversation
This is very promising. Have you thought of including the initial code cache inside the compiled executable as well? |
Yeah, maybe at a later time and as a separate option. The problem is it will make the binary much larger. |
It all depends on the use case. For some use cases, improving the startup time on the second attempt onwards as opposed to in the first attempt in favor of a reduced binary size will make a lot of sense. For other cases, it will not make any sense at all. For example: containers. There's only one startup attempt in that case. |
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.
LGTM
@@ -337,6 +380,23 @@ impl ModuleLoader for EmbeddedModuleLoader { | |||
))), | |||
} | |||
} | |||
|
|||
fn code_cache_ready( |
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.
Unrelated to this PR, we should make this method be able to return sync or async response to save some ticks maybe.
Adds a lazily created code cache to
deno compile
by default.The code cache is created on first run to a single file in the temp directory and is only written once. After it's been written, the code cache becomes read only on subsequent runs. Only the modules loaded during startup are cached (dynamic imports are not code cached).
The code cache can be disabled by compiling with
--no-code-cache
.Closes #26502