-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Cleanups for Mill client #3363
Cleanups for Mill client #3363
Conversation
os.pwd
in an isolated sandbox folderThere 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.
The idea of the in-process runner was to retire the different entry points and the script-based decision logic. But it looks like you intend to keep the script logic in the prepended script. Is that so? Wouldn't it be better to optimize the Java code for in-process server and remove all the script logic?
@@ -2,7 +2,7 @@ | |||
|
|||
class FileLocked implements Locked { | |||
|
|||
private java.nio.channels.FileLock lock; | |||
protected java.nio.channels.FileLock lock; |
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.
Do we really need to expose this mutable variable? Can we make it final
or provide a protected
getter?
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.
?
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.
opening a separate PR to finalize this and a bunch of other things that probably should be final
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.
final
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 think we'll likely always have a client server architecture for performance. Keeping JVM compiler objects hot and jitted requires them to be long lived. The only question is where you draw the line:
We are now at (2). I think trying to get to (3) makes the most sense. (1) could work, but the overhead of short lived thick JVMs is significant even if the heavy lifting compilers etc are kept alive elsewhere. (4) would probably be an unreasonable amount of complexity to implement in bash Given the idea to move from (2) to (3) above, this PR removes the inprocess mill execution code path from the client, since we'll always have two JVMs for the reasons above |
follow up for #3363 * Remove the `public`-ness from `FileTryLocked` and `MemoryTryLocked`. They do not need to be public, as people should only access them through the `TryLocked` interface * Add `final` to the fields that do not need to be mutated (i.e. all of them) * Make `Locks` `final`, and replace weird anonymous class initializers with a proper constructor
ServerFiles.*
andOutFiles.*
have been turned into constant fields where possibleclient/
code layout has been overhauled:MillClientMain
/MillEnv
have been re-organized intoMillClientMain
,MillLauncher
,MillServerLauncher
,MillNoServerLauncher
MillClientMain.main0
, now living inMillServerLauncher.runMain
, has been broken down:runMillServer
has been extracted out of it, and theLocks
/Lock
/Locked
logic has been tweaked with the addition ofTryLocked implements AutoClosable
to let us fold some logic into the try-with-resources blockRemoved the code path for running the Mill server in-process: this cuts down the number of execution modes from 3 to 2, server and no-server. There'll be a bit of performance hit spawning another JVM for the no-server mode, but IMO it's worth it for the simplicity and maintainability of this gnarly code, and is necessary for moving the Mill
os.pwd
out of the root directory into a sandboxSome preparations for moving the Mill
os.pwd
out of the root directory into a sandbox, e.g. introducing aMILL_WORKSPACE_ROOT
environment variable and plumbing it throughout the codebaseThis should help improve the code and implementation quality of the Mill client-server codebase and set the stage for further development