Skip to content
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

Cache template directory in init command #1896

Merged
merged 34 commits into from
Aug 4, 2023

Conversation

hpmellema
Copy link
Contributor

Description of changes:
Caches a copy of the smithy init template directory in the default system temp directory. This greatly speeds up subsequent executions of both the list and create template subcommands of the smithy init.
Previously, creating a template could take up to 6 seconds. With this change that time is down to ~0.3sec after the initial caching of the template repo.


Example Executions
Create a Template
cli

List Templates
list

Note: the gif recorder used here adds additional lag so these do not accurately represent the time these commands take to execute.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@hpmellema hpmellema marked this pull request as ready for review August 1, 2023 18:58
@hpmellema hpmellema requested a review from a team as a code owner August 1, 2023 18:58
@mtdowling
Copy link
Member

mtdowling commented Aug 1, 2023

rather than cache to the temp directory, I suggest caching to the build directory somewhere, allowing smithy clean to be used to clear any caches.

Copy link
Member

@mtdowling mtdowling left a comment

Choose a reason for hiding this comment

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

Is it possible to add integration tests for the added functionality of the init command?

@hpmellema hpmellema requested a review from mtdowling August 3, 2023 17:05
@hpmellema
Copy link
Contributor Author

hpmellema commented Aug 3, 2023

For some reason the file lock on the .git pack files on the windows runner do not seem to be released (possibly due to the windows git file monitor?). I am working on trying to find the root cause and a fix, but in the mean time this PR will have to wait for that fix.

Update: Issue appears to actually be that git for windows marks pack files as readonly.
see this question for more context

@hpmellema hpmellema requested a review from mtdowling August 4, 2023 17:21
@hpmellema hpmellema merged commit 30d8efa into smithy-lang:main Aug 4, 2023
@hpmellema hpmellema deleted the cache-template-repo branch August 4, 2023 19:17
syall pushed a commit to Xtansia/smithy that referenced this pull request Aug 11, 2023
Adds caching of smithy init template directory in the default system temp directory. This greatly speeds up subsequent executions of both the list and create template subcommands of the smithy init.
alextwoods pushed a commit to alextwoods/smithy that referenced this pull request Sep 15, 2023
Adds caching of smithy init template directory in the default system temp directory. This greatly speeds up subsequent executions of both the list and create template subcommands of the smithy init.
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