-
-
Notifications
You must be signed in to change notification settings - Fork 111
Rewrite write_source_files into a fast language #1119
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
base: main
Are you sure you want to change the base?
Conversation
}) | ||
} | ||
|
||
func doCopy(action copyAction) error { |
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.
We have Go programs in this repo for CopyFile and CopyDirectory mnemonics. I imagine it could share code, or perhaps even just update that binary with some more flags to handle this use 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.
CopyFile uses cp
but I think you're talking about the copy_directory
and CloneFile
stuff in tools/common
?
I saw those initially but it wasn't super trivial to reuse because tools/copy_directory
does its own concurrency control and I didn't want multiple layers spawning goroutines. Looking at it again, however, it does look like we can do a bit of restructuring so that write_source_files
handles enqueueing the work and there's a single pool of workers. Happy to give that a shot.
I think adding more flags to the existing programs is less appealing, because:
- We currently don't use any flags for
write_source_files
sinceRunEnvironmentInfo
can only take env vars, no args. To use args we'd need to emit launcher scripts vs just symlinking the executable like we do now, which requires forking on platform again - I think it's clearer to understand the tools when they have separate well-defined entrypoints for the (fairly different) use cases
It does mean distributing an extra toolchain + slightly bigger downloads, but that doesn't feel like a huge drawback, WDYT?
@alexeagle I updated the PR with a sketch of how some code can be shared. There's a few things bothering me:
Overall I can't tell if going down this path will create a mess or result in improvements to the existing implementations, but if we do want to unify we will probably want some prep PRs |
I'm sorry I disappeared here! If your analysis leads you to think that sharing code isn't beneficial here, I'm on board with that. These are small programs, and distributing them is easy. I think the highest-order bit is to make it easy to maintain and avoid bugs since we don't have any funding for this org. |
95a5fd4
to
6ba817f
Compare
On a
write_source_files
tree with ~20 chained targets and a few files each (so total 90 files + directories) the runtimes goes from 5-7s to 20ms.We will want to precompile the helper binary like the rest of the helpers.
Putting this up to get feedback first.