Skip to content

Conversation

@aceysmith
Copy link

Description of Changes

The spacetime dev and spacetime generate commands always overwrite the .env.local and module_bindings files, even if the contents are identical. This can be a nuisance if your client is watching for changes and reloading, as spacetime dev will modify both of those at different times in the process.

This change will first read the contents of the files and see if a write is necessary.

For writing .env.local as part of spacetime dev, the file contents were already read so no real impact should exist.

For module_bindings, I've done some initial profiling with 181 generated typescript files and separately 161 rust files and noticed no performance impact.

API and ABI breaking changes

None

Expected complexity level and risk

1

Testing

I've ran this code on a project that generates 181 source files for typescript and 161 for rust. It correctly writes files when changes have been made and leaves the files unmodified if no changes are made.

For review testing, I would recommend running both with and without my change on a much more complex project if it's available. I would think not writing the contents of each file would mitigate the cost to read most of the time, but perhaps in certain project makeup scenarios and storage performance characteristics, this could possible be marginally slower sometimes, though I have not observed that to be the case.

Copy link
Contributor

@cloutiertyler cloutiertyler left a comment

Choose a reason for hiding this comment

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

Requested a small change, but otherwise would love to merge this.

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.

2 participants