-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
JIT zig fmt
and zig reduce
#19102
Merged
Merged
JIT zig fmt
and zig reduce
#19102
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
andrewrk
force-pushed
the
decouple-zir
branch
from
February 27, 2024 04:04
34e6fa6
to
afc4008
Compare
Part of an effort to ship more of the compiler in source form.
Note that the correctness of these enum tag values is still protected by the comptime logic at the top of Zcu (currently src/Module.zig).
Part of an effort to ship more of the compiler in source form.
This frees up std.zig.fmt to be used for the implementation of `zig fmt`.
Part of an effort to ship more of the compiler in source form.
This results in "file exists in multiple modules" errors. A future commit should move these subcommands to outside std/.
andrewrk
force-pushed
the
decouple-zir
branch
from
February 27, 2024 05:55
afc4008
to
ba57559
Compare
very exciting! one suggestion I'd make is moving fmt's main to |
I'd like to move this file but to do so requires a zig1.wasm update, so I'll choose a more opportune moment to make this change.
for lazily built commands such as `zig fmt` and `zig reduce`. Useful if you want to test a patch to them.
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.
ችኅን
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementation of #19063 for
zig fmt
andzig reduce
.The first run takes 10 seconds or so but when every run is a cache hit, the timing difference is insignificant, or somehow faster even.
This makes the rendering code (i.e. lib/std/zig/render.zig) dead for primary compiler builds. This did not have much of an effect on how long it takes to build the compiler (see below) probably because it's just not that much code, and it's not using any slow stuff like gratuitous formatting, comptime blocks, or use of the inline keyword.
I expect to see more time saved when applying this to Aro, Resinator, translate-c, etc., which represent a much more substantial amount of code.
After this branch is merged, it becomes easier to contribute to
zig fmt
andzig reduce
. Contributors no longer need to rebuild the compiler to test changes. You can useZIG_DEBUG_CMD=1 zig fmt ...
to get a debug build of the format subcommand, which could be useful when working onzig fmt
itself. Same thing forzig reduce
.